Johannes Fredborg wrote: > 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 co1 = false begin ans1 = gets.chomp case ans1 when 'black' co1 = 0 when 'brown' co1 = 1 else puts puts 'Not acepted, please retype the color' end end until co1 puts puts 'type in the next color' ans2 = gets.chomp --- Another way. ----- choice_set = [ %w(black brown), %w(blue green) ] colors = [] choice_set.each{|choices| begin puts "Type one of these colors:" puts choices num = choices.index( gets.chomp ) or puts '', 'Not acepted, please retype the color' end until num colors << num }