# `scanln`
The inverse of `println`
---
## Overview
`scanln` is a macro that reads a line from `stdin`, [removes the trailing
newline][2] (if present), and leaves other whitespace intact. It expands to an
expression that returns a [`String`][0], so it can be assigned to a variable or
used directly. `scanln` may take arguments like those to the [`print`][1] macro,
which can be used to generate a prompt.
## Examples
### Simple prompt
```rust
let input = scanln!("> ");
```
This results in a prompt that looks like this (where `_` represents where the
user will start typing):
```
> _
```
### No prompt
```rust
let input = scanln!();
```
Result:
```
_
```
### Formatted prompt
```rust
let input = scanln!("{}", 0);
```
Result:
```
0_
```
[0]: https://doc.rust-lang.org/std/string/struct.String.html
[1]: https://doc.rust-lang.org/std/macro.print.html
[2]: https://users.rust-lang.org/t/remove-the-new-line-from-read-line/21380