Updated 2011-07-07 09:25:55 by dkf

Optional argument of if. Example of the implicit else:
 % if true {puts yep} {puts nope}
 yep
 % if false {puts yep} {puts nope}
 nope
 %

Example with the explicity else:
 % if true then {puts yep} else {puts nope}
 yep
 % if false then {puts yep} else {puts nope}
 nope
 %

It's usually good style to put the else in for clarity, as there's no performance impact for most code. Compare with then...

Also, elseif introduces an alternative condition.
 if true then {puts yes} elseif $whatever {puts no} else {puts dunno}

Note that the two words have to be written together (without space in between), while in C you must have a space. RS 2007-06-01