小编age*_*fin的帖子

Chris Pine学习编程Ruby Ch 9:心理测试计划

因此,我正在跟随Chris Pine进行心理测试[burrito,taco,wets_bed]计划...是的,我改为"Escape:The Pina Colada song"的歌词,但不然,保持不变.

然而,它仍然停留在第一个"问"上...救命?

我不想彻底改变这一点,只是想找到程序挂起的地方.

# Nice little questionnaire 

def ask question
  good_answer = false
  while (not good_answer)
    puts question
    reply = gets.chomp.downcase

    if (reply == 'yes' or reply == 'no' )
      good_answer == true
      if reply == 'yes'
        answer = true
      else
        answer = false
      end
    else 
      puts 'Please answer "yes" or "no".'
    end
  end

  answer # This is what we return (true or false)
end

puts 'Hello, and thank you for smoking.'

puts

ask 'Do you …
Run Code Online (Sandbox Code Playgroud)

ruby methods ruby-on-rails

0
推荐指数
1
解决办法
325
查看次数

标签 统计

methods ×1

ruby ×1

ruby-on-rails ×1