Skip to content

Instantly share code, notes, and snippets.

@Yardanico
Last active October 11, 2017 15:48
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 Yardanico/851a97914bb196f85affe69e5b0eb153 to your computer and use it in GitHub Desktop.
Save Yardanico/851a97914bb196f85affe69e5b0eb153 to your computer and use it in GitHub Desktop.
import macros, strutils
template readLn(args: varargs[typed]): untyped =
let data = stdin.readLine().split()
var i = 0
while i < args.len:
let value = data[i]
when arg is int:
arg = parseInt(value)
elif arg is float:
arg = parseFloat(value)
elif arg is string:
arg = value
elif arg is bool:
arg = parseBool(value)
inc i
var
a, b, c: int
d: bool
readLn(a, b, c, d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment