倒计时至午夜 目标 练习建立一个while循环 练习使用减法和赋值运算符( -= )-加法和赋值运算符( += )的反函数。 审查 在while循环上 本实验将测试您在while循环中的编写技能。请记住,仅当您定义的条件评估结果为true , while循环才会执行您的代码块。 例如,此脚本: x = 1 while x < 10 puts " #{ x } is less than 10" x += 1 end 将打印此: 1 is less than 10 2 is less than 10 3 is less than 10 4 is less than 10 5 is less than 10 6 is less than 10 7 is less than 10 8 is less than 10 9 is less than 10 并返回nil 。 字符串插值 使用