Go to the first, previous, next, last section, table of contents.
The section 2.7 if command allows commands to be executed conditionally.
Syntax:
if (<condition>) <command-line>
<condition> will be evaluated. If it is true (non-zero), then the command(s) of the <command-line> will be executed. If <condition> is false (zero), then the entire <command-line> is ignored. Note that use of `;` to allow multiple commands on the same line will _not_ end the conditionalized commands.
Examples:
pi=3
if (pi!=acos(-1)) print "?Fixing pi!"; pi=acos(-1); print pi
will display:
?Fixing pi!
3.14159265358979
but
if (1==2) print "Never see this"; print "Or this either"
will not display anything.
See section 2.15 reread for an example of how section 2.7 if and section 2.15 reread can be used together to perform a loop.
Go to the first, previous, next, last section, table of contents.