VALUE_OF
Last updated
Was this helpful?
Last updated
Was this helpful?
The function VALUE_OF takes a variable of any data type and returns its value.
This function takes as single variable of any as input. It returns the value of the given variable.
input (required, type: any) A variable of any data type.
input_value (type: any) The value of the variable given as input.
The VALUE_OF function must be given a variable as input. Hardcoding input will cause it to throw an error, as in the following example:
Assume all subsequent examples have access to the following variable, example_number:
Giving example_number as input to the function VALUE_OF causes it to output the number 3:
The function VALUE_OF accepts all data types as input, including and , which themselves might contain different types of data. For instance, assume all subsequent examples have access to the following variable, example_object. Note that example_object had two properties: "number", and "name", the values of which are a and a data type, respectively:
The relatively complexity of example_object does not prevent VALUE_OF from returning the value it contains when given example_objectas input:
In the vast majority of cases when the value of a variable is needed, it can be accessed simply by calling on the variable itself. That is, given some variable example:
In these cases, use of the function VALUE_OF is unnecessary. This is because, by default, variables in Airkit are writable
.
However, under very particular circumstances, such as when working with Custom Controls, a variable might be readOnly
when a writable
variable is needed. Giving a readOnly
variable as input to VALUE_OF returns a value that can be saved as a writable
variable.