hi, since I just started learning Ruby I’m still having troubles to make
things work properly. So, here’s the case. I decided to write an app
that will emulate rolling diced, simple as that and just print result.
I’m working with NetBeans and Ruby plugins and here’s my syntax.
“def dice_roller()
puts “What dice do you want to roll?”
dice = gets.chomp
if dice == “d4”
dice_d4 = Random.new
puts “Your score is #{dice_d4}”
end
if dice == “d6”
dice_d6 = Random.new
puts “Your score is #{dice_d6}”
end
if dice == “d8”
dice_d8 = Random.new
puts “Your score is #{dice_d8}”
end
if dice == “d10”
dice_d10 = Random.new
puts “Your score is #{dice_d10}”
end
if dice == “d12”
dice_d12 = Random.new
puts “Your score is #{dice_d12}”
end
if dice == “d20”
dice_d20 = Random.new
puts “Your score is #{dice_d20}”
end
end”
Would you, please, tell me what is wrong? And if at least I’m heading in
the right direction?