Test foreach() loop.
Všechny kontroly byly úspěšné
The build was successful.

Tento commit je obsažen v:
Rafal Kupiec 2019-05-02 18:51:12 +02:00
rodič 8f681d1605
revize 73c1a814f5
Podepsáno: belliash
ID GPG klíče: 4E829243E0CFE6B4
2 změnil soubory, kde provedl 33 přidání a 0 odebrání

21
tests/loop_foreach_test.aer Normální soubor
Zobrazit soubor

@ -0,0 +1,21 @@
class Program {
void main() {
int[] $numbers = {'five' => 5, 'six' => 6, 'seven' => 7, 'eight' => 8, 'nine' => 9, 'zero' => 0};
string[] $days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
foreach(string $key => int $numeric in $numbers) {
if($numeric == 6) {
continue;
}
print("$key is $numeric\n");
if($numeric == 8) {
break;
}
}
print("\nA week has seven days:\n");
foreach(string $day in $days) {
print("$day\n");
}
}
}

12
tests/loop_foreach_test.exp Normální soubor
Zobrazit soubor

@ -0,0 +1,12 @@
five is 5
seven is 7
eight is 8
A week has seven days:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday