Skip to content

Commit

Permalink
added case_odd_even_lambda.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthikeyan A K committed Aug 11, 2015
1 parent f938c10 commit 2939aac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions case_odd_even_lambda.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# case_odd_even_lambda.rb

num = 76

case num
when -> (n) { n % 2 == 0 }
puts "#{num} is even"
else
puts "#{num} is odd"
end

0 comments on commit 2939aac

Please sign in to comment.