Avatar ·

How to output text in Rust without a newline at the end?

Hi everyone! I just started learning Rust and ran into what seems like a simple problem. In Python, I'm used to using `print("text", end="")` to output something without a newline. In Rust, I tried the `println!()` macro, but it always adds `\n` at the end. I need to output several values sequentially on one line, for example, for a progress indicator or for line-by-line data input. Here's what I tried: ```rust fn main() { println!("Loading: "); for i in 0..5 { println!("{} ", i); // I want the numbers to be on one line } println!("Done!"); } ``` This code outputs each number on a new line, but I need: `Loading: 0 1 2 3 4 Done!` I read the documentation, but only found `println!()`, which always adds a new line. Is there