Concatenation of string and int value in nim
Asked Answered
S

1

8

I want to concatenate string and int. But it doesn't work with & and add operator.

echo "abc" & 2

But it doesn't work.

Skyward answered 29/1, 2018 at 10:14 Comment(0)
S
15

There's an operator $ that converts something to string.

echo "abc" & $2
echo "abc", 2 # echo automatically applies `$` to its arguments
Sagamore answered 29/1, 2018 at 10:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.