Mercurial > repos > tabletprog
comparison samples/range.tp @ 343:21e20c9bb2ba
Added range module and sample
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 05 Apr 2015 23:35:05 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
342:884cd5d54c0f | 343:21e20c9bb2ba |
---|---|
1 #{ | |
2 main <- { | |
3 foreach: (range from: 10 to: 20) :idx el { | |
4 print: (string: idx) . ": " . el . "\n" | |
5 } | |
6 sum <- (range from: 0 to: 100 by: 3) fold: 0 with: :acc el { | |
7 acc + el | |
8 } | |
9 print: "Sum of range from: 0 to: 100 by: 3 is " . sum . "\n" | |
10 } | |
11 } |