May 13, 2006

ruby.lesson.4

so there is a for loop in ruby! ;-)
here used for counting sheep hidden in array:
def countSheep(tab)
for i in 0…tab.length
print tab[i]
end
end
result = 0
tab = [1, 2, 3, 4, 5, 6, 7, 8]
countSheep(tab)