Ruby code forces the answer using a loop and a branch to guess my favorite ice cream flavor
There is no need to write the gets and the string comparison code twice. The following code is equivalent:

puts "What is my favorite ice cream flavor?"
while gets.chomp.capitalize != "Vanilla"
   puts "Wrong answer; what is my favorite ice cream flavor?"
end
puts "Now that's my jam"