diff --git a/guide/chinese/ruby/ruby-conditionals/index.md b/guide/chinese/ruby/ruby-conditionals/index.md index af4c77dd05..77674b2452 100644 --- a/guide/chinese/ruby/ruby-conditionals/index.md +++ b/guide/chinese/ruby/ruby-conditionals/index.md @@ -20,15 +20,21 @@ Ruby有几个常用的条件。 end ``` - - -### 除非声明 + +## 除非声明 除非语句与if语句相反。它与否定的if语句相同。 * `ruby happy = true if !happy puts "This person is not happy" end` 以上陈述等同于以下陈述 * `ruby unless happy puts "This person is not happy" end` +## 句尾条件 + +在ruby当里我们也常将条件至于句尾 + +* `puts "Your fruit is an apple" if fruit == :apple` +* `puts "This is not an apple" unless fruit == :apple` + ## 三元声明 三元语句用作短条件语句。它写成如下 @@ -51,4 +57,4 @@ case语句类似于if / elsif / else语句 puts "This is not an apple or an orange" end - ``` \ No newline at end of file + ```