2007-08-21

9 ways to count to 10

$ i=1;while [ $i -lt 11 ];do echo $i; i=$(($i+1));done
$ i=1;until [ $i -eq 11 ];do echo $i; i=$(($i+1));done
$ seq 1 10
$ python -c 'for i in xrange(1,11): print i'
$ perl -e 'for $i (1 .. 10){ print "$i\n";}'
$ ruby -e '(1..10).each {|i| print i,"\n"}'
$ ruby -e '1.upto(10) {|i| puts i}'`
$ ruby -e 'for i in 1..10 do print i, "\n" end'
$ lua -e 'for i=1,10 do print(i) end'

1 comment:

VirtualSMF said...

Don't forget:

select * from ( select level from dual connect by level < 11 );

;D -- hey dude! found this linked from 'steads.. couldn't resist! 8D