Advertisement
sauerCHAOS

steploop

Jun 3rd, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. // arg1 = loop control variable
  2. // arg2 = iterations
  3. // arg3 = step number
  4. // arg4 = body
  5. // arg5 = starting index
  6.  
  7. steploop = [
  8.     loop $arg1 $arg2 [
  9.         if (! (mod $$arg1 @arg3)) [
  10.             $arg1 = (+ $$arg1 $arg5)
  11.             @@arg4
  12.         ]
  13.     ]
  14. ]
  15.  
  16. // e.g.
  17. // list = "0 1 2 3 4 5 6 7 8 9"
  18. // steploop p (listlen $list) 2 [echo $p] 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement