Last active
August 1, 2017 18:09
-
-
Save kyku/388fe17a4896d56abc8407a53138db1b to your computer and use it in GitHub Desktop.
nil check in crystal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "option_parser" | |
value = nil | |
parser = OptionParser.parse! do |parser| | |
parser.on("--value VALUE", "mortgage value") {|v| value = v.to_u32} | |
end | |
if value | |
puts "non-nil-case" | |
puts value + 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment