Update page 'Aer v1.0 Specification'
@@ -57,7 +57,7 @@ There are several kinds of operators and punctuators. Operators are used in expr
|
|||||||
#### 3.3.3 Keywords
|
#### 3.3.3 Keywords
|
||||||
A keyword is a reserved word in the Aer language. Keywords are used to perform a specific task in a computer program; for example, print a value, do repetitive tasks, or perform logical operations. A programmer cannot use a keyword as an ordinary variable.
|
A keyword is a reserved word in the Aer language. Keywords are used to perform a specific task in a computer program; for example, print a value, do repetitive tasks, or perform logical operations. A programmer cannot use a keyword as an ordinary variable.
|
||||||
|
|
||||||
Available keywords: as, break, case, catch, class, clone, const, continue, default, do, else, elseif, extends, final, finally, for, foreach, if, implements, interface, instanceof, namespace, new, private, protected, public, static, switch, throw, try, using, virtual, while
|
Available keywords: break, case, catch, class, clone, const, continue, default, do, else, elseif, extends, final, finally, for, foreach, if, implements, in, interface, instanceof, namespace, new, private, protected, public, static, switch, throw, try, using, virtual, while
|
||||||
|
|
||||||
Next we have other language constructs: define() empty(), exit(), eval(), import(), include(), isset(), list(), require(), return(), print()
|
Next we have other language constructs: define() empty(), exit(), eval(), import(), include(), isset(), list(), require(), return(), print()
|
||||||
|
|
||||||
@@ -450,7 +450,7 @@ The foreach construct simplifies traversing over collections of data. It has no
|
|||||||
string[] $days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
|
string[] $days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
|
||||||
"Saturday", "Sunday" };
|
"Saturday", "Sunday" };
|
||||||
string $day;
|
string $day;
|
||||||
foreach ($days as $day) {
|
foreach ($day in $days) {
|
||||||
print("$day\n");
|
print("$day\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,12 +460,10 @@ There is another syntax of the foreach statement. Below form will additionally a
|
|||||||
|
|
||||||
string[] $benelux = { 'be' => 'Belgium', 'lu' => 'Luxembourgh', 'nl' => 'Netherlands' };
|
string[] $benelux = { 'be' => 'Belgium', 'lu' => 'Luxembourgh', 'nl' => 'Netherlands' };
|
||||||
string $key, $value;
|
string $key, $value;
|
||||||
foreach ($benelux as (string) $key => $value) {
|
foreach ($key => $value in $benelux) {
|
||||||
print("$key is $value\n");
|
print("$key is $value\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Casting a $key to string in above example can be useful, because Aer supports arrays with both numeric and associative indexes. This means that if above array contained additional row with integer-based key, it would be casted to string automatically.
|
|
||||||
|
|
||||||
### 7.7. Break & Continue Statements
|
### 7.7. Break & Continue Statements
|
||||||
The break statement is used to terminate the loop. The continue statement is used to skip a part of the loop and continue with the next iteration of the loop.
|
The break statement is used to terminate the loop. The continue statement is used to skip a part of the loop and continue with the next iteration of the loop.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user