Anonymous user
Loop over multiple arrays simultaneously: Difference between revisions
Loop over multiple arrays simultaneously (view source)
Revision as of 16:11, 14 September 2009
, 14 years agoAdd new section for Lisaac
m (→{{header|J}}) |
(Add new section for Lisaac) |
||
Line 121:
This implementation rejects arrays with conflicting lengths.
=={{header|Lisaac}}==
<lang Lisaac>
Section Header
+ name := ARRAY_LOOP_TEST;
Section Public
- main <- (
+ a1, a2 : ARRAY[CHARACTER];
+ a3 : ARRAY[INTEGER];
a1 := ARRAY[CHARACTER].create 1 to 3;
a2 := ARRAY[CHARACTER].create 1 to 3;
a3 := ARRAY[INTEGER].create 1 to 3;
1.to 3 do { i : INTEGER;
a1.put ((i - 1 + 'a'.code).to_character) to i;
a2.put ((i - 1 + 'A'.code).to_character) to i;
a3.put i to i;
};
1.to 3 do { i : INTEGER;
a1.item(i).print;
a2.item(i).print;
a3.item(i).print;
'\n'.print;
};
);
</lang>
=={{header|Logo}}==
|