Odd if statement

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Odd if statement

Post by phaworth » Tue Mar 12, 2013 4:37 pm

I've noticed comma has special treatment in other places too. For a long time I was using:

answer "this is a string" & comma & "this is another string"

Then I stumbled across doing it this way, which has the same result:

answer "this is a string","this is another string"

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Odd if statement

Post by mwieder » Tue Mar 12, 2013 5:36 pm

Pete-

I'm sure I've come across places where the shortened comma syntax doesn't always work, but I can't think of them right now.

Anyway, as Mark correctly points out, math evaluation precedes equivalence evaluation, so as long as the values aren't quoted they'll be evaluated before testing to see if the results are equal.

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: Odd if statement

Post by phaworth » Tue Mar 12, 2013 7:08 pm

Hi Mark,
Yep, the "naked comma" only seems to work in certain places for sure. I thought at one time that perhaps it had something to do with comma being the item delimiter, but I tried changing the itemdelim to something other than comma then using that character in an expression and got a compile error.

Post Reply