|
Gri Commands
1: Introduction 2: Simple example 3: Fancy example 4: Running Gri 5: Programming Gri 6: General Issues 7: X-Y Plots 8: Contour Plots 9: Image Plots 10: Examples 11: Handling Data 12: Gri Commands 13: Gri Extras 14: Evolution of Gri 15: Installing Gri 16: Gri Bugs 17: System Tools 18: Acknowledgments 19: License 20: Newsgroup 21: Concept Index |
12.17: The `
(See also see If Statements..)
|
`if {[!] .flag.}|\flag|{{"string1" == "string2"}}'
|
if' block is ended with a line
containing `end if'. Optional `else' and `else if'
blocks are allowed. Note that rpn expressions are allowed, and a
special form of string comparison is allowed, as in the examples below.
if .flag. # List of Gri commands to be done if .flag. is 1. # This list may extend across any number of lines. end if |
.flag.' is not equal to 0, do the code between the
`if' line and the `end if' line.
if .flag. # Commands done if .flag. is 1 else # Commands done if .flag. is 0 end if |
.flag.' is not equal to 0, do the code between the
`if' line and the `else' line. If `.flag.' is equal to
0, do the code between the `else' line and the `end if' line.
if ! .flag. # Commands done if .flag. is 0 end if |
.flag.' is equal to 0, do the code between the
`if' line and the `end if' line.
if {rpn .flag. 10 <}
# Commands done if 10 is less than .flag.
end if
|
.flag.' is less than 10, do the code between the
`if' line and the `end if' line.
if \smooth # Commands done if \smooth is 1 else # Commands done if \smooth is 0 end if |
\smooth' is not equal to 0, do
the code between the `if' line and the `else' line. If the
synonym stores a representation of a number not equal to zero, do the
`else' part. If the synonym contains text that does not decode to
a number, generate error message.
if {"\item" == "Temperature"}
# Commands done if the synonym \item is equal to the
# indicated text string.
end if
|
\item' has the value `Temperature' stored in
it, do the indicated code.
if {rpn "\item" "Temperature" ==}
# Commands done if the synonym \item
# equals indicated text string.
end if
|
rpn' calculator
(see rpn Mathematics.).
if {rpn "\item" "Temperature" !=}
# ...
end if
|
\item' is not equal
to `Temperature'.