| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7.2 Program flow commands
Below I show commands to control program flow, like, conditions, loops, define script arguments and so on. Other commands can be found in chapters MathGL core and Data processing. Note, that some of program flow commands (like define, ask, call, for, func) should be placed alone in the string.
- MGL command: ask $N 'question'
Sets N-th script argument to answer which give the user on the question. Usually this show dialog with question where user can enter some text as answer. Here N is digit (0...9) or alpha (a...z).
- MGL command: define $N smth
Sets N-th script argument to smth. Note, that smth is used as is (with ‘'’ symbols if present). Here N is digit (0...9) or alpha (a...z).
- MGL command: define name smth
Create scalar variable
namewhich have the numeric value ofsmth. Later you can use this variable as usual number.
- MGL command: defchr $N smth
Sets N-th script argument to character with value evaluated from smth. Here N is digit (0...9) or alpha (a...z).
- MGL command: defnum $N smth
Sets N-th script argument to number with value evaluated from smth. Here N is digit (0...9) or alpha (a...z).
- MGL command: defpal $N smth
Sets N-th script argument to palette character at position evaluated from smth. Here N is digit (0...9) or alpha (a...z).
- MGL command: call 'fname' [ARG1 ARG2 ... ARG9]
Executes function fname (or script if function is not found). Optional arguments will be passed to functions. See also func.
- MGL command: func 'fname' [narg=0]
Define the function fname and number of required arguments. The arguments will be placed in script parameters $1, $2, ... $9. Note, you should stop script execution before function definition(s) by command stop. See also return.
- MGL command: return
Return from the function. See also func.
- MGL command: elseif dat 'cond'
Starts block which will be executed if previous
iforelseifis false and dat satisfy to cond.
- MGL command: elseif
val Starts block which will be executed if previous
iforelseifis false andvalis nonzero.
- MGL command: for $N
v1 v2 [dv=1] Starts cycle with $N-th argument changing from v1 to v2 with the step dv. Here N is digit (0...9) or alpha (a...z).
- MGL command: for $N dat
Starts cycle with $N-th argument changing for dat values. Here N is digit (0...9) or alpha (a...z).
- MGL command: once
val The code between
once onandonce offwill be executed only once. Useful for large data manipulation in programs like UDAV.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 21, 2014 using texi2html 5.0.
