D
Deza Awesome
I want my program to say a diffrent maths question everytime the user
goes through the cycle, however it just does the same one What can I
do to achive my goal?
V2 = 1 + rand(22)
V1 = 1 + rand(22)
class Die
def roll
1 + rand(22)
end
end
def hello
puts 'whats your name'
name = gets.chomp
puts "Hello ". + name
end
def maths_question
puts 'Whats the sum of ' + V2.to_s + ' and ' + V1.to_s + ' ?'
youSAY = gets.chomp
while youSAY != CorrectA.to_s
puts 'Wrong, please try again'
youSAY = gets.chomp
end
end
def maths_congrats
puts 'Congrats, you got ' + CorrectA.to_s + ', which was the correct
answer!'
end
hello
puts 'Do you want to do maths questions?'
domath = gets.chomp
while domath == 'yes'
CorrectA = V1.to_i + V2.to_i
maths_question
maths_congrats
puts 'Do you want to do more?'
domath = gets.chomp
end
goes through the cycle, however it just does the same one What can I
do to achive my goal?
V2 = 1 + rand(22)
V1 = 1 + rand(22)
class Die
def roll
1 + rand(22)
end
end
def hello
puts 'whats your name'
name = gets.chomp
puts "Hello ". + name
end
def maths_question
puts 'Whats the sum of ' + V2.to_s + ' and ' + V1.to_s + ' ?'
youSAY = gets.chomp
while youSAY != CorrectA.to_s
puts 'Wrong, please try again'
youSAY = gets.chomp
end
end
def maths_congrats
puts 'Congrats, you got ' + CorrectA.to_s + ', which was the correct
answer!'
end
hello
puts 'Do you want to do maths questions?'
domath = gets.chomp
while domath == 'yes'
CorrectA = V1.to_i + V2.to_i
maths_question
maths_congrats
puts 'Do you want to do more?'
domath = gets.chomp
end