I'm making a program in rust has an output like this but I'm failed.
Enter String: Hi
How many copies of String you need: 3
3 Copies of Hi are HiHiHi
but my code gives me this
HI
HI
HI
while i < index {
println!("{}", text);
i += 1;
}
I'm making a program in rust has an output like this but I'm failed.
Enter String: Hi
How many copies of String you need: 3
3 Copies of Hi are HiHiHi
but my code gives me this
HI
HI
HI
while i < index {
println!("{}", text);
i += 1;
}
println adds a newline by default (that is what the ln stands for, line).
Try to use the print macro instead.