Function ftkit::read_number

source ·
pub fn read_number() -> i32
Expand description

Reads a number from the standard input. The function loops indefinitely until a valid number is provided.

Panics

This function panics if it fails to read from the standard input of the program.

Examples

println!("How old are you?");
let age = ftkit::read_number();
println!("Oh? So you are {age} year(s) old?");