J
Johannes Fredborg
Okay guys!
I am pritty new to Ruby programing and i need your help.
Is it possibel to ask the program to go back to another program line
number and then proceed from there?
an exampele:
ans1 = gets.chomp <----------------- (proceed from here)
if ans1 == 'black'
co1 = 0
puts
puts 'type in the next color'
ans2 = gets.chomp
end
if ans1 == 'brown'
co1 = 1
puts
puts 'type in the next color'
ans2 = gets.chomp
end
if co1 == nil
puts
puts 'Not acepted, please retype the color'
goto.line 1 <------------------------------ (this was just a wild wild
guess)
end
...
...
Do you see what i mean? is this possibel to do. Or is there another way
that I can achieve the same effect?
Any help? Thanks!
I am pritty new to Ruby programing and i need your help.
Is it possibel to ask the program to go back to another program line
number and then proceed from there?
an exampele:
ans1 = gets.chomp <----------------- (proceed from here)
if ans1 == 'black'
co1 = 0
puts
puts 'type in the next color'
ans2 = gets.chomp
end
if ans1 == 'brown'
co1 = 1
puts
puts 'type in the next color'
ans2 = gets.chomp
end
if co1 == nil
puts
puts 'Not acepted, please retype the color'
goto.line 1 <------------------------------ (this was just a wild wild
guess)
end
...
...
Do you see what i mean? is this possibel to do. Or is there another way
that I can achieve the same effect?
Any help? Thanks!