这可能是一个愚蠢的问题,但我就是无法让它工作。我很确定我错过了什么。
我想将一个布尔值设置为 false
然后只有在满足条件时才将其设置为 true
。
boolTest = false
until boolTest = true
puts "Enter one fo these choices: add / update / display / delete?"
choice = gets.chomp.downcase
if choice == "add" || choice == "update" || choice == "display" || choice == "delete"
boolTest = true
end
end
我刚开始学习Ruby,可能会混淆其他语言的能力。
bool_test
(蛇形命名法),而不是boolTest
(驼峰命名法)。 - Sergio Tulentsev直到boolTest == true
。 - Sergio Tulentsev