How do you turn a Number to a String?

Version 1.19.3

How do you turn one data type into another? I’m trying to make a integer into a string to make a score counter.

I’m trying to do:

but there is a “str()” function.

Is there another way to do it or something?

Well, there are multiple methods to do this.

Let’s say the number was 5.
The first method would be to use the String function, rather than str

String(5) // this should equal "5"

The second method would be to add the 5 with a string. When you add a number with a string, the number is automatically converted to a string, which is kinda nice. In the example below, I added (or rather, joined ) an empty string "" with the number 5

""+5 // this should equal "5"

(Fun fact, you can also convert a string to a number by multiplying it by 1, or using the Number function)


Thank you so much I had no idea about that

1 Like