progn, prog1
progn, prog1 — group several statements into one expression.
progn {!statement [!statement] ...}
prog1 {!statement [!statement] ...}
statementAny valid Gamma statement.
progn: the return value of the last statement.
prog1: the return value of the first statement.
These two syntactical elements are not statements, but they transform a
group of one or more statements into a single Gamma expression. The value of
the resulting expression is the return value of the last statement for
progn or the first statement for
prog1. This is useful for performing complex
actions where only a single expression is permitted, such as in a callback.
No new scope is entered for a progn or a
prog1.
![]() | |
The syntax of these unique elements uses curly braces |
Gamma>a = 2;2Gamma>b = 5;5Gamma>progn{a = 3; princ("a: ",a,"\n"); c = a + b; princ("c: ",c,"\n");};a: 3 c: 8 tGamma>string( prog1{a = 5; b = 1;} );"5"Gamma>a;5Gamma>b;1Gamma>