[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.5 Loops and conditionals
Loops and conditionals are defined as follows, and can be imbricated:
-
For ( expression : expression )
Iterates from the value of the first expression to the value of the second expression, with a unit incrementation step. At each iteration, the commands comprised between `
For ( expression : expression )
' and the matchingEndFor
are executed.-
For ( expression : expression : expression )
Iterates from the value of the first expression to the value of the second expression, with a positive or negative incrementation step equal to the third expression. At each iteration, the commands comprised between `
For ( expression : expression : expression )
' and the matchingEndFor
are executed.-
For string In { expression : expression }
Iterates from the value of the first expression to the value of the second expression, with a unit incrementation step. At each iteration, the value of the iterate is affected to an expression named string, and the commands comprised between `
For string In { expression : expression }
' and the matchingEndFor
are executed.-
For string In { expression : expression : expression }
Iterates from the value of the first expression to the value of the second expression, with a positive or negative incrementation step equal to the third expression. At each iteration, the value of the iterate is affected to an expression named string, and the commands comprised between `
For string In { expression : expression : expression }
' and the matchingEndFor
are executed.-
EndFor
Ends a matching
For
command.-
If ( expression )
The body enclosed between `
If ( expression )
' and the matchingEndif
is evaluated if expression is non-zero.-
EndIf
Ends a matching
If
command.
See ‘t5.geo’, for an example of For
and If
commands. Gmsh
does not provide any Else
(or similar) command at the time of this
writing.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |