% $Id: ForLoopExamples.oz,v 1.1 2008/03/04 04:03:12 leavens Exp leavens $ % Examples of Oz for loops with Collect \insert 'TestingNoStop.oz' {StartTesting 'For Loop Examples'} {Test for E in [1 2 3 4] collect: Results do {Results E+1} end '==' [2 3 4 5]} declare fun {GreaterThan Ls N} for E in Ls collect: BigEnough do if E > N then {BigEnough E} end end end {StartTesting 'GreaterThan'} {Test {GreaterThan nil 3} '==' nil} {Test {GreaterThan [1 2 3 4 5 2] 3} '==' [4 5]} {Test {GreaterThan [1 2 3 4 5 2] 4} '==' [5]}