exercism / ruby

Exercism exercises in Ruby.
https://exercism.org/tracks/ruby
MIT License
556 stars 518 forks source link

Correction: Conditional concept document introduction.md #1693

Closed swati-goyal closed 5 months ago

swati-goyal commented 5 months ago

Else statement

The else statement can be used in conjunction with the if and unless statements. The else statement will be executed if the if branch or the unless branch is not executed.

value = 1
if value == 1
  "1 is equal to 1"
else
  "1 is not equal to 1"
end
# => "1 is equal to 1"

unless value < 2
  "1 is not greater than 2"
end
# => "1 is greater than 2" 

-- Change to below , because unless is executed when condition is falsey

unless value < 2
  "1 is not greater than 2"
end
# => nil
kotp commented 5 months ago

Related to issue #1688 but being discussed here