Difference between revisions of "Typecasting"
From Flowcode Help
Jump to navigationJump to searchLine 29: | Line 29: | ||
− | If we want to assign a integer variable as a floating point variable then we can use the " | + | If we want to assign a integer variable as a floating point variable then we can use the "FLOAT" typecast operator. |
− | FloatVar = | + | FloatVar = FLOAT IntVar |
Line 38: | Line 38: | ||
− | FloatVar = | + | FloatVar = FLOAT (IntVar * 5) |
Line 44: | Line 44: | ||
− | *FloatVar = | + | *FloatVar = FLOAT 5 |
*FloatVar = 5.0 | *FloatVar = 5.0 |
Revision as of 15:48, 20 September 2024
Operators
Typecasting is a way of specifying what we want in terms of the assignment and the values passed to the assignment.
Typecast operators:
- string
- float
- signed
- unsigned
Converting to string
If we want to assign a numeric variable as an ASCII string then we can use the "STRING" typecast operator.
StringVar = STRING NumericVar
This can be taken further and used on results of calculations etc.
StringVar = STRING(NumericVar * 5)
Converting to float
If we want to assign a integer variable as a floating point variable then we can use the "FLOAT" typecast operator.
FloatVar = FLOAT IntVar
This can be taken further and used on results of calculations etc.
FloatVar = FLOAT (IntVar * 5)
To assign a float status to a fixed value we can do one of the following.
- FloatVar = FLOAT 5
- FloatVar = 5.0