π¦ Expression
π¦ Expression
The Expression block allows you to perform mathematical calculations or logical evaluations based on a custom formula. It acts as an advanced calculator or validator for complex conditions (e.g. life > 100 and mana < 50), automatically generating the necessary inputs for the variables used in the expression.
This block is particularly useful for centralizing operations that would otherwise require multiple blocks of calculation or logic, while dynamically adapting to the required variables.
π₯ Entries
- expression (Text): Mathematical or logical formula to evaluate (eg:
price * quantityorage >= 18). Variables not defined in the project automatically create dynamic input connectors. - Dynamic variables (Number/Text/Boolean): Entries automatically generated for each variable detected in the expression (eg:
price,quantity,age).
π€ Outings
- result (Number/Text/Boolean): Value resulting from the evaluation of the expression. The type automatically adapts to the result (Boolean for conditions, Number for calculations, Text for concatenations).
π‘ Example of use
Scenario: Calculating the total price of an order with discount
- A user fills out a form with the quantity of items (
3) and the unit price (29.99). - The stream passes these values ββto an Expression block.
- In the Expression block, the author enters the formula:
price * quantity * 0.9(applying a 10% reduction). - The block automatically generates two dynamic inputs:
price(Number) andquantity(Number). - The form values ββare connected to the corresponding inputs.
- The
resultoutput (80.9725) is transmitted to a Text block to display the message: "Total after reduction: β¬80.97".
βοΈ Technical Details
- Dynamic input generation: The block analyzes the expression in real time and creates the necessary connectors for each unknown variable. The entry types are deduced from the context (e.g.
age >= 18generates anageentry of type Number). - Automatic output typing: The type of
resultis determined by the evaluation of the expression (ex:5 > 3β Boolean,"Hello" + "World"β Text). - Supported syntax: Mathematical operators (
+,-,*,/,%), logical (&&,||,!), and comparisons (>,<,==,!=). Advanced functions depend on the execution environment.
Updated on: 04/03/2026
Thank you!
