Jump to content

Typecasting: Difference between revisions

From Flowcode Help
Created page with "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 For example if we ..."
 
No edit summary
Line 1: Line 1:
==Operators==
Typecasting is a way of specifying what we want in terms of the assignment and the values passed to the assignment.
Typecasting is a way of specifying what we want in terms of the assignment and the values passed to the assignment.




Typecast operators:
Typecast operators:


*string
*string
*float
*float
*signed
*unsigned




For example if we want to display a numeric variable as an ASCII string then we can use the "string" typecast.
==Converting to string==
 
 
If we want to assign a numeric variable as an ASCII string then we can use the "string" typecast operator.




Line 19: Line 25:


StringVar = string (NumericVar * 5)
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

Revision as of 14:16, 10 March 2014

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