Conditional structures: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 3,779: | Line 3,779: | ||
===if expressions=== |
===if expressions=== |
||
If expressions are scoped per section. |
If expressions are scoped per section. |
||
<syntaxhighlight lang="langur"> |
<syntaxhighlight lang="langur">if .x == 0 { |
||
# ... and that a decoupling assignment returns a Boolean... |
|||
if val .alias, .name = submatch($re/^(\.idregex;)\\s*;\\s*(\.idregex;)/, .row) { |
|||
# success (2 or more values in array returned from submatch function) |
|||
# use .alias and .name here |
|||
... |
... |
||
} else if .x > 0 { |
} else if .x > 0 { |
||
Line 3,793: | Line 3,788: | ||
... |
... |
||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
Prior to langur 0.10, you would use parentheses around the declared variable names (.alias, .name). |
|||
===shortened form if expression=== |
===shortened form if expression=== |