block start:
simple: ^\s*@\s*{iterations}\s*$
range: ^\s*@\s*{start}\s*\.\.\s*{end}\s*$
while: ^\s*@\?\s*{while}\s*..\s*{limit}\s*$
until: ^\s*@\s*$
foreach: ^\s*@@\s*{var}\s*$
block end: ^\s*/\s*$
until-block end: ^\s*/\s*{until}\s*..\s*{limit}\s*$
break: >/
continue: >>
index counter: @
foreach value: @
foreach key: @@
Simple Loop:
@ iterations
actions
/
Range Loop:
@ start .. end
actions
/
While- and until-loops are the most frequent
reason for program crashes,
and therefore have a
mandatory lifeline in Eas.
Their
limit parameter must be given
as an integer number constant greater than 0.
The loop will be aborted automatically
after the set limit of iterations.
While-Loop:
@? run-condition .. limit
actions
/
Until-Loop:
@/ stop-condition .. limit
actions
/
Foreach-Loop:
@@ varname
actions
/
To
break (stop and leave) a loop:
>/
To
continue a loop,
i.e. skip to the next iteration:
>>
The current
iteration counter
(for all loop types except foreach)
can be read by:
@
It tells the current index for range loops,
counts from 0 upwards for simple loops
and from 1 upwards
for while and foreach loops.
The @ read-only pseudo-variable
also exists for foreach-loops,
where it returns the
array value,
while the
array key is returned by
the second read-only pseudo-variable:
@@
They are valid only for the loop
they are immediately situated in.
To carry their value into a nested loop
or outside of the loop,
copy it to a regular variable.
If you use the @ pseudo-variable
in a while- or until-loop condition,
it refers to that very loop.
Whereas if you use it in the header of an
iteration loop (simple, range or foreach),
it refers to the parent loop of it.
Both @ and @@ can be used
as
point-syntax array keys:
array.@ = array[@]
array.@@ = array[@@]
And they can be used like
variables in strings:
@99..0
?@=0
SAY:"All bottles are gone."
>/
/
SAY:"Still ;@ bottle"
?@>1
SAY:"s"
/
SAY:" on the wall."/
/
Also remember that strings
are treated as arrays of chars,
so the foreach-loop works
perfectly with strings as well.
PHP:
for($i=0;$i<10;$i++)$a[]=$i;
Eas:
@10
a..@
/
-- or --
@0..9
a..@
/
JS:
for(i=5;i<=9;i++)a[i]=0
Pascal:
for i:=5 to 9 do a[i]:=0;
Eas:
@5..9
a.@ 0
/
JS:
for(i=9;i>=5;i--)a[i]=0
Pascal:
for i:=9 downto 5 do a[i]:=0;
Eas:
@9..5
a.@ 0
/
PHP:
while($x>3){
if($x==15)break;
$a[]=$x--;
}
Eas:
@?x>3..1000
?x=15
>/
/
a..x
x-
/
Pascal:
l:=Length(a);
Repeat
inc(l);
SetLength(a,l);
a[l]:=x;
inc(x);
Until x>8;
PHP:
do$a[]=$x++;while($x<9);
Eas:
@
a..x
x+
/x>8..1000
PHP:
foreach($a as$v){
if(!($v&1))continue;
$b[]=$c;
}
JS:
for(v in a){
v=a[v]
if(!(v&1))continue
b[b.length]=v
}
Eas:
@@a
?@.*1=0
>>
/
b..@
/
PHP:
for($i=0;$i<strlen($mystr);$i++){
echo"char $i is \"".$mystr{$i}."\"\n";
}
Eas:
@@mystr
SAY:"char ;@@ is "";@"""/
/
PHP:
foreach($a as$k=>$v)$b[]="$k:$v";
Eas:
@@a
b..";@@:;@"
/