Skip to content

Commit 254b434

Browse files
author
clauddzy
committed
Update cascading if example
1 parent 93c1cfa commit 254b434

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

concepts/conditionals/about.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ There can also be an else statement at the end of the if statement which will ru
112112

113113
```ruby
114114
value = 1
115-
if value != 1
116-
"1 is not equal to 1"
115+
if value == 0
116+
"1 is equal to 0"
117117
elsif value > 2
118118
"1 is greater than 2"
119119
else
120-
"1 is not equal to 1 and 1 is not greater than 2"
120+
"1 is not equal to 0 and 1 is not greater than 2"
121121
end
122-
# => "1 is not equal to 1 and 1 is not greater than 2"
122+
# => "1 is not equal to 0 and 1 is not greater than 2"
123123
```
124124

125125
## if and unless as suffix

concepts/conditionals/introduction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ There can also be an else statement at the end of the if statement which will ru
9999

100100
```ruby
101101
value = 1
102-
if value != 1
103-
"1 is not equal to 1"
102+
if value == 0
103+
"1 is equal to 0"
104104
elsif value > 2
105105
"1 is greater than 2"
106106
else
107-
"1 is not equal to 1 and 1 is not greater than 2"
107+
"1 is not equal to 0 and 1 is not greater than 2"
108108
end
109-
# => "1 is not equal to 1 and 1 is not greater than 2"
109+
# => "1 is not equal to 0 and 1 is not greater than 2"
110110
```
111111

112112
[comparison-operators]: https://www.w3resource.com/ruby/ruby-comparison-operators.php

0 commit comments

Comments
 (0)