I would like to print without skipping lines in Nim.
this is my code by far
int i = 1
for i in countup(1, 10):
echo "number: "
echo i
I would like the output to be:
number: (i value)
...
instead of:
number:
(i value)
I would like to print without skipping lines in Nim.
this is my code by far
int i = 1
for i in countup(1, 10):
echo "number: "
echo i
I would like the output to be:
number: (i value)
...
instead of:
number:
(i value)
Convert i to a string with the $ operator, then concatenate the strings using the & operator.
echo "number: " & $i
You can also write to stdout
directly with
stdout.write "number: "
echo i
which will print a newline after printing the value of i
stdout.write "insert something\n> "
–
Senghor Convert i to a string with the $ operator, then concatenate the strings using the & operator.
echo "number: " & $i
echo "number: ", i
, without concatenating and forcing conversion. In my opinion, this leads to cleaner code. –
Custody © 2022 - 2024 — McMap. All rights reserved.
echo "number: ", i
, without concatenating and forcing conversion. In my opinion, this leads to cleaner code. – Custody