I have been trying to make a while loop in ruby that responds to user input. What is supposed to happen is that when a user inputs the word "Omega" correctly it ends the loop and displays a message, if the word "hint" is entered a message is displayed and the loop repeats, and anything else will have a "try again" message displayed. What is happening is that regardless of what is entered, the loop just asks the original question.
Can anyone find what is wrong with my code, thank you
@GateOneLocked = true
GateOnePassword = String.new('Omega')
GateOneHint= String.new('hint')
#Omega is supposed to be the correct password
while (@GateOneLocked == true) do
puts 'What is the password?'
passwordEntered = gets.to_s
if (@passwordEntered == @GateOnePassword)
@GateOneLocked == false
else if (@passwordEntered != @GateOneHint)
puts "This is a hint: the password is 'Omega'"
puts " "
puts " "
else
puts "wrong password, try again"
puts " "
puts " "
end
end
end
puts 'You entered the correct password!'