Control Structures: General Concepts
Control structures are common in most semi-modern computer languages. Since
Glee is interpretive and vector oriented, use of control
structures it is not a very efficient form of coding. However, after exhausting
opportunities for vectorizing and still being short of your solution, control
structures become essential. Further, efficiency is not always an issue. Often,
using control structures simplifies the code and makes it clearer. For some
more general comments, press
.
|
Structure |
Semantics |
|
How GLEE deals with
Control Structures |
Understand how GLEE
deals with control structures internally and you will likely save yourself some
confusion and grief later on. |
|
:for |
:for
(iter[.fieldlist]){args[.fieldlist]{code}} |
|
:if
:elseif
:else |
:if(test)
{a[.fl]{code}}
:elseif (test) {a[.fl]{code}}
...
:else {a[.fl]{code}} |
|
:select
:case
:default |
:select (v[.fl]{expr})
[.fl] {
:case (test) {(a[.fl]){code}}
...
:default (#true) {(a[.fl;]){code}}
} |
|
:do
:while |
:do
(a[.fl]){(a[.fl]){code}}
:while(a[.fl]{test}) |
|
:while
:do |
:while (a[.fl]{test})
:do {(a[.fl]){code}} |
|
:try
:catch
:finally |
:try {
(a[.fl]){code}
:catch (a[.fl]{test}){(a[.fl]){code}}
...
:finally {(v[.fl]{Block}
} |