How to create a string with a repeated character N times in Rust

1 Answer

0 votes
fn main() {
    let repeated = "*".repeat(10); // Repeats '*' 10 times
    
    println!("{}", repeated);
}


    
/*
run:

**********
   
*/

 



answered Jul 28 by avibootz
...