Skip to content

Instantly share code, notes, and snippets.

@PradeepLoganathan
Created June 13, 2017 06:44
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 PradeepLoganathan/a1f2558782e9665b26f5635db5a81cf7 to your computer and use it in GitHub Desktop.
Save PradeepLoganathan/a1f2558782e9665b26f5635db5a81cf7 to your computer and use it in GitHub Desktop.
if (int.TryParse(input, out var quantity))
WriteLine(quantity);
else
WriteLine("Quantity is not a valid integer!");
WriteLine($"{nameof(quantity)}: {quantity}"); // still valid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment