Loops/Do-while: Difference between revisions

Line 2,064:
}
Old_Style
// modern style, using high order functions
module generic_iterator {
do_while = lambda (f, p)->{
{
if p(f()) then loop
}
}
funcA=lambda (start_from, do_what) -> {
=lambda i=start_from, do_what ->{
call do_what(i)
=i
i++
}
}
funcPrint=lambda ->{
print number
}
call do_while(funcA(1, funcPrint), lambda->number mod 6 <>0)
}
generic_iterator
</syntaxhighlight>
 
Line 2,071 ⟶ 2,091:
1 2 3 4 5 6
1 2 3 4 5 6
1
2
3
4
5
6
1
2
404

edits