'Coordinate' syntax

Dar Scott dsc at swcp.com
Mon Jun 13 17:46:46 EDT 2016


The comma is an infix string concatenation operator much like & and &&.  

a,b 
is the same as 
a & comma & b

Pretty handy.  

This can get you into trouble if you accidentally put parentheses around command parameters.  You end up with one argument, a comma separated list.  The compiler doesn't catch it because it is valid.  

Dar


> On Jun 13, 2016, at 3:34 PM, Graham Samuel <livfoss at mac.com> wrote:
> 
> In the BMI example which introduces LC 8, there occurs this line of script:
> 
>  put the cHeight of this stack, the cWeight of this stack into tCoordinates
> 
> This has the effect of putting two values (the values of the two custom props) separated by a comma into the variable ‘tCoordinates’. I was surprised by this. Has it always been legal to do this kind of thing without an overt string expression? I would have expected to have to do
> 
>  put (the cHeight of this stack) & ”,” & (the cWeight of this stack) into tCoordinates
> 
> I don’t see in the first version how LC ‘knows’ that the separating comma is legitimate.
> 
> Is everyone else OK with this?
> 
> Graham
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list