Browse Source

We can now declare key and value variables inside a loop.

release/v0.1
Rafal Kupiec 1 year ago
parent
commit
186e5887f6
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
1 changed files with 1 additions and 3 deletions
  1. +1
    -3
      tests/arab_to_roman.aer

+ 1
- 3
tests/arab_to_roman.aer View File

@ -8,9 +8,7 @@ class Program {
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1};
int $matches;
string $roman;
int $value;
foreach($roman => $value in $lookup) {
foreach(string $roman => int $value in $lookup) {
$matches = (int) ($n / $value);
$result += str_repeat($roman, $matches);
$n = $n % $value;

Loading…
Cancel
Save