返回顶部

收藏

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-02-09 11:56:59use curly braces ({}): by Loli控
  2. 2016-02-17 20:44:19The if Statement with constant by Jamin
  3. 2016-03-29 16:55:30Nested for loop by 杨洋
  4. 2016-09-06 17:58:38general form of the for loop by Loli控
  5. 2016-09-06 20:50:38throw sends a message to catch if n is less than or equal to 0. by Loli控
  6. 2016-09-07 11:14:26do all the times tables from 1 to 12 by LeoSun
  7. 2016-11-01 09:24:09If vs Case by digua
  8. 2015-12-06 17:14:38All Ruby expressions return a result by 胡晋
  9. 2016-03-02 11:18:28nest if logic by jeffsui
  10. 2016-09-06 18:18:46For each item in by 杨洋
  11. 2016-09-06 21:11:42basic way to implement a loop by Ω油菜
相关聚客文章
  1. Peter Cooper 发表 2012-11-26 07:24:36 The Split is Not Enough: Unicode Whitespace Shenig
  2. 周亮 发表 2013-01-07 15:37:17 几个有意思的Ruby命令行参数
  3. 博主 发表 2005-11-04 08:00:00 many things inspired by ruby on rails
  4. Philip Howard 发表 2012-06-20 00:00:00 Remote Ruby with LIRC
  5. pjr 发表 2013-05-06 12:50:50 Mac 下rvm 安装 ruby出错
  6. 博主 发表 2013-05-14 13:00:00 Ruby 1.9.3-p426 is released
  7. xiaoxiao 发表 2013-05-20 04:53:39 ruby json问题
  8. polyzz 发表 2013-06-01 03:25:02 [北京] 招聘ruby程序员
  9. shlallen 发表 2013-06-07 02:15:24 ruby代码实现JasperReports Server WebService REST API调用
  10. ShiningRay 发表 2013-06-15 16:01:09 [南京][2013年06月29日] 第一次 Ruby 聚会召集
  11. blacktulip 发表 2013-06-22 16:42:40 求 JS 代码对应的 Ruby 代码...
  12. hellolucky 发表 2013-06-26 16:09:35 [ Ruby on Rails ] Rails4 學習心得整理 (上)

发表评论