Now the Assign Value node supports general operation to be assigned as a value. This is a big improvement because you can use various types of functions as well as basic calculations.

To use this feature, create an Assign Value node and click 'Add Variable', select the target variable, then select 'Operation' as a type. Then you're all ready to type in operation.

As you see in the example above, you can use variables to be included in operation. And here are the calculations and the functions you can use in operation.

Basic calculations

  • +, -, *, /, ( )
  • % (modulus)
    Example: 100%2 = 0, 100%8 = 4.
  • ** (power)
    Example: 100**2 = 10,000.

Functions

Any function works with function() format. For example, abs(-5).

  • to_number: Convert the value to number format.
    Example: to_number('4') = 4
  • to_string: Convert the value to string format.
    Example: to_string(7) = '7'
  • to_boolean: Convert the value to boolean format.
    Example: to_boolean(1) = True
  • length = Return the length of the value.
    Example: length('abcde') = 5
  • abs = Return the absolute value of the value.
    Example: abs(-5) = 5
  • sin, cos, tan = Return sin, cos, tan of the value.
    Example: tan(90) = 1
  • ceil, floor = Return round up or round down value.
    Example: floor(2.1) = 2
  • random, random_int = random() returns random number value between 0 and 1. random_int(min, max) returns a random whole number value between the min and the max values.
    Example: random_int(-1, 2) = -1, 0, 1, or 2