I'm messing around in Ruby some more. I have a file containing a class with two methods and the following code:
if __FILE__ == $0 seq = NumericSequence.new puts "\n1. Fibonacci Sequence" puts "\n2. Pascal\'s Triangle" puts "\nEnter your selection: " choice = gets puts "\nExcellent choice." choice = case when 1 puts "\n\nHow many fibonacci numbers would you like? " limit = gets.to_i seq.fibo(limit) { |x| puts "Fibonacci number: #{x}\n" } when 2 puts "\n\nHow many rows of Pascal's Triangle would you like?" n = gets.to_i (0..n).each {|num| seq.pascal_triangle_row(num) \ {|row| puts "#{row} "}; puts "\n"} end end How come if I run the code and supply option 2, it still runs the first case?