Wheel IDE

Online demo »

String, number

String number example

This shows how to convert a number to a string and a string to a number.

Code

#project "String number example"

#include "lib/modules/standard.whl"
#include "lib/modules/string.whl"

proc main()
    clearConsole()

    ; Declare a string and a number:
    string s
    number n = 2.79

    ; Convert the number to a string and print the string in the console:
    numberToString(n, s)
    printS("Number to string:")
    printS(s)

    ; Assign a numeric value to a string, convert it to a number and print the number in the console:
    s = "4.67"
    n = stringToNumber(s)
    printS("String to number:")
    printN(n)
end