Created
July 3, 2013 19:56
-
-
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ä.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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