Logo

Programming-Idioms

History of Idiom 120 > diff from v26 to v27

Edit summary for version 27 by Okx:
New Elixir implementation by user [Okx]

Version 26

2016-11-18, 10:36:55

Version 27

2018-03-21, 21:32:03

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Code
n = String.to_integer IO.gets ""
Doc URL
https://hexdocs.pm/elixir/IO.html#gets/2
Demo URL
https://tio.run/##S83JrMgs@v8/T8FWIbikKDMvXa8kPz4zryQ1PbVIwdNfLz21pFhBSek/kJmZV1yQmlyikPffBAA