From: aidy Date: 2006-08-08T23:50:07+09:00 Subject: Goto in Ruby? I have a simple web GUI that I would like to read a file and enter data into This is my class class Form def initialize @filename = "search.txt" end def enter_data read_in_test_data.each { |x| line = x.chomp #need to log testId next if line.upcase.include? 'TESTID' next if line.upcase == 'ADDRESS:' $ie.text_field(:name, 'Address1').set(line) $ie.text_field(:name, 'Address2').set(line) $ie.text_field(:name, 'Address3').set(line) $ie.text_field(:name, 'Address4').set(line) $ie.text_field(:name, 'Address5').set(line) $ie.text_field(:name, 'Address6').set(line) $ie.text_field(:name, 'Address7').set(line) } end def read_in_test_data #check if file exists and give date of last change File.readlines(@filename, "\n" ) end private:read_in_test_data end this is an example of the file I am reading *********************************************** TESTID_10 Address: 30 Choyce Close Atherstone Warwickshire Country: GB Search-Results: 20 *********************************************** TESTID_20 Address: Hamilton Chartered Surveyors Aidy Street Bath Country: GB Search-Results: 1 *********************************************** TESTID_30 Sometimes the address can be upto 1..7 lines. What I am looking for is something like a goto statement, that when 'Country:' is found a different field can be filled in e.g.($ie.text_field(:name, 'Ctry1').set(line). Thanks for the help Cheers Aidy