Skip to content

Instantly share code, notes, and snippets.

@vuorejo1
Created July 3, 2013 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vuorejo1/5922213 to your computer and use it in GitHub Desktop.
Save vuorejo1/5922213 to your computer and use it in GitHub Desktop.
Ei oo vielä valmis, ihmettelen miksi .each antaa herjan: undefined method `each' for nil:NilClass.. Oon siis ruby koanseja tekemässä.
# Implement a DiceSet Class here:
class DiceSet
def initialize
@noppaluvut = Array.new(5)
end
def roll(montako)
# if montako.size == 0 || montako.size > 6
# raise error?
# arvo noppaluvut, parametri kertoo montako noppaa?
@noppaluvut.each do |item|
item = rand(1..6)
end
end
def values
return @noppaluvut
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment