Skip to content

Instantly share code, notes, and snippets.

@kyku
Last active August 1, 2017 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyku/388fe17a4896d56abc8407a53138db1b to your computer and use it in GitHub Desktop.
Save kyku/388fe17a4896d56abc8407a53138db1b to your computer and use it in GitHub Desktop.
nil check in crystal
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