Jump to content

Loop over multiple arrays simultaneously: Difference between revisions

Add new section for Lisaac
(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}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.