Much of the LiveCode language is very similar to English. For example, setting a variable "myVar" to 2 you write:
put 2 into myVar
Ok, it's very lengthy. But you understand this LiveCode statement because it means the same in English.
Setting an object property require another word set:
set the location of graphic myDraw to 20,30
Any extra space before or after statements is ignored by LiveCode. Loops or function declaration don't require parenthesis.
repeat 5 times answer "test" end repeat
The above works perfectly by showing an answer 5 times. Each LiveCode statement must be placed on a line by itself. If the 3 statements above are put on a single line, it stops working, giving an error. LiveCode sees this as one long faulty statement.
In LiveCode, the math priority is the same as in regular human math, so the following is correct:
put (2 + 3) * 5 * (cos(3.14) - 1/3) into aVariable
You can change the priority by adding parentheses. The inner most parenthesis is done first, then the next outer one, and so forth. Math is not the only thing with priority, so parentheses can be used in several different settings.
An if / then statement can be placed on one line if there is only one action to be performed. For example:
if myVar = 2 then put myVar into field "txtVar" -- if myVar = 2 then field = 2
If there is more that one action to performed, a multi-line If / then statement form must be used.
For exmple:
if myVar > 2 then -- if myVar = 2, then put myVar into field "txtGreaterVar" -- field = 2 put empty into field "txtLessVar" -- field is empty end if
Comments are ignored by LiveCode. This can be very useful. See Comments.