Explicit Type Conversion
Last updated
Last updated
In the case of type conversion from a larger data type to a small data type, there is a possibility of potential loss of information. To avoid any user input mistakes or accidental user intent, Langstack applications protect the users against the implicit or automatic type conversion of larger data types to smaller data types.
If the users still require such conversions, they can do so by explicitly choosing the available conversion functions.
In the Action below, the variable num1
(data type Numerical) is updated to variable int1
(data type Integer) explicitly with an expression that converts the num1 variable to an integer using the toInteger()
function.