返回顶部

收藏

unless can work in exactly the same way because unless is just the opposite of if:

更多
age = 10
unless age >= 18
  puts 'You're too young to use this system'
  puts 'So we're going to exit your program now'
  exit
end

标签:Ruby,Statement

收藏

0人收藏

支持

0

反对

0

»更多 您可能感兴趣的代码
  1. 2016-01-02 10:26:21Catch and Throw by zetaliang
  2. 2016-09-06 17:38:22downto method with integer by 胡晋
  3. 2016-09-06 20:45:33begin by Loli控
  4. 2015-12-06 17:14:38All Ruby expressions return a result by 胡晋
  5. 2016-02-09 11:56:59use curly braces ({}): by Loli控
  6. 2016-02-17 20:44:19The if Statement with constant by Jamin
  7. 2016-03-29 16:55:30Nested for loop by 杨洋
  8. 2016-09-06 17:58:38general form of the for loop by Loli控
  9. 2016-09-06 20:50:38throw sends a message to catch if n is less than or equal to 0. by Loli控
  10. 2016-09-07 11:14:26do all the times tables from 1 to 12 by LeoSun
  11. 2019-02-13 14:14:06Java的用途有哪些? by edulofter

发表评论