How to create a string with newlines in Rust

1 Answer

0 votes
fn main() {
    let string = "rust\njava\nc#\nc\npython".to_string();
    
    println!("{}", string);
}




 
/*
run:
   
rust
java
c#
c
python
   
*/

 



answered May 30, 2023 by avibootz
...