next up previous contents
Next: while Up: Scripting Previous: if

if-else

The if-else structure is a useful variant of the if structure. It will evaluate a truth condition. If it finds it to be true, it will execute one block of code, if it finds it to be false, it will evaluate another.

if 1>0, a=2; else, a=3; end

In this case, if 1 is greater than zero, it will evaluate a=2 if 1 is not greater than zero then it will evaluate a=3.



Arun Francis Rodrigues
1999-08-17