Skip to content

Instantly share code, notes, and snippets.

@Papierkorb
Created August 1, 2017 18:16
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 Papierkorb/c5d02b076378da4038b9319dfafcd5a4 to your computer and use it in GitHub Desktop.
Save Papierkorb/c5d02b076378da4038b9319dfafcd5a4 to your computer and use it in GitHub Desktop.
require "option_parser"
value = nil
parser = OptionParser.parse! do |parser|
parser.on("--value VALUE", "mortgage value") {|v| value = v.to_u32}
end
if v = value ### <---
puts "non-nil-case"
puts v + 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment