>>>> There will be more to come this weekend, I will be doing my home work
>>>> and posting the stuff here. Sorry for not being able to comment on
>>>> anyone's code yet.

Quoting myself! Just after the game finished I am posting my code, I
will post the other tomorrow was I can hardly see the screen now!

>>

#!/usr/bin/ruby

rand_n = %w{}
odd_n = %w{}

20.times { rand_n << rand(100) + 1 }

puts rand_n.sort.join(', ')
puts

rand_n.sort.select { |rand_n| odd_n.push rand_n if rand_n % 2 != 0 }

puts odd_n.join(', ')

>>

What is the difference if I declare the array like that:

my_array = []

or like that

my_array = %w{}

Please feel free to criticise my code!

Regards,
Vini
_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

Reply via email to