So I'm trying to understand the loop functions in ruby. I have a chunk of code that does what I want it to do. But I'd like to loop the section that starts with the math variable until one of the conditions is met. I've updated this to show one way I've tried. Looked here and on (https://launchschool.com/books/ruby/read/loops_iterators) but I'm not understanding the process. I'm really new to this. If you have a resource I could reference that would be awesome. If you have a solution with tips on why it works even better. This is what I've tried. It's probably laughably bad.
puts "Welcome to math.rb!"
puts "Enter a number!"
user = gets.to_i
puts "Enter another number!"
user2 = gets.to_i
puts "What would you like to do with your number?"
math = gets.chomp.downcase
until math == ["add", "subtract", "multiply"]
case math
when "add"
puts user + user2
when "subtract"
puts user - user2
when "multiply"
puts user * user2
else
puts "I don't understand! Type a command like:
-add
-subtract
-multiply"
end