Please enable JavaScript to view this site.

Exlipicit conversion

It is possible to make explicit data conversion of a value (or variable) from one type to another, simply specifying the new data type before the value (or variable).

<target variable> = <type> <source variable>

<target variable> = <type> (<source variable>)

For example:

; Explict conversion from real to integer

int value1

real value2

 

value2 = real value1

value2 = real(value1)

Conversion is not allowed on left side of an assignment: in this case, the value is automatically converted into the corresponding assignment target type.

Implicit conversion

As a general rule, when you make an operation between different data types, an implicit conversion can happen to all values according to the first operand/value data type. For example:

int value1

real value2

 

; Value will be converted in 5.0 type, eg real data type

value2 = 5.0 + value1   

 

; 1.2 will be converted in value1, eg int (precision loss)

value1 = 1.2            

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC