create file which writes numbers from 1 to 10 in every line in rust

main.rs
use std::fs::File;
use std::io::{Write};

fn main() {
    let mut file = File::create("numbers.txt").unwrap();

    for i in 1..=10 {
        writeln!(&mut file, "{}", i).unwrap();
    }
}
189 chars
11 lines

related categories

gistlibby LogSnag