From 1f5dde3418d166863cec507d6e2bd53a145aa281 Mon Sep 17 00:00:00 2001 From: Rafal Kupiec Date: Tue, 30 Apr 2019 23:46:27 +0200 Subject: [PATCH] Update page 'Aer v1.0 Specification' --- Aer-v1.0-Specification.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Aer-v1.0-Specification.md b/Aer-v1.0-Specification.md index ef0135e..ecbb466 100644 --- a/Aer-v1.0-Specification.md +++ b/Aer-v1.0-Specification.md @@ -57,7 +57,7 @@ There are several kinds of operators and punctuators. Operators are used in expr #### 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. -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() @@ -450,7 +450,7 @@ The foreach construct simplifies traversing over collections of data. It has no string[] $days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; string $day; - foreach ($days as $day) { + foreach ($day in $days) { 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 $key, $value; - foreach ($benelux as (string) $key => $value) { + foreach ($key => $value in $benelux) { 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 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.