0 def goto(label)
1 calls = File.open(FILE).read
2 if calls.lines.to_s.include?(label) == true
3 label_checker = {}
4 calls.lines.each {|x|
label_checker.store(calls.lines.find_index(x),
5 x.to_s.include?(label))} == true
6 i = 0
7 while i <= label_checker.length do
8 if label_checker[i] == true
9 puts calls.lines.to_a[i]
10 puts label
11 puts calls.lines.to_a[i].equal?(label)
12 if calls.lines.to_a[i].equal?(label) == true
13 puts “come on now…” #calls.lines.to_a[i]
14 end
15 end
16 i += 1
17 end
18 else
19 return “#{label} not initialized”
20 end
21 end
22
23 goto(“#label001:”)
24 #label002:
25 puts “hmm… here…”
26 exit
27 #label001:
28 puts “but not here…”
29 puts file = File.open(FILE).read
30 puts file.lines.index
31 goto(“#label002:”)
This is what i have so far and im using
http://www.compileonline.com/execute_ruby_online.php as the interpreter.
What i don’t understand is line 11 should equal true… yet returns
false.
Any thoughts, and I know about call.cc and catch / throw this is mainly
something to code to the way i enjoy.