Studio Yotsuba
Back to Node List

Expression Bool

expression_bool

Evaluates a small expression and outputs a bool

Reviewed
Guide available

Input Ports

NameTypeDescription
X
x
Number
Number variable x
Y
y
Number
Number variable y
Vec
vec
Vec2
Optional vec2 variable
Flag
flag
Bool
Optional bool variable

Output Ports

NameTypeDescription
Value
value
Bool
Bool result of the expression

Parameters

NameTypeDefaultRangeDescription / Options
X
x
Float
0-10000–10000 / step 0.01

Fallback value for x when the input pin is not connected

Y
y
Float
0-10000–10000 / step 0.01

Fallback value for y when the input pin is not connected

Vec X
vec_x
Float
0-10000–10000 / step 0.01

Fallback X component for vec when the vec input pin is not connected

Vec Y
vec_y
Float
0-10000–10000 / step 0.01

Fallback Y component for vec when the vec input pin is not connected

Flag
flag
Bool
false—

Fallback bool value when the flag input pin is not connected

Expression
expression
Text
x > 0.5—

Returns true or false. Examples: - x < 0.5 - flag || x > 0.5 - length(vec) >= 4 Connected input pins override Inspector values.

Overview

Produces one true / false value from a short expression. Instead of arranging compare and logical-operation nodes, write a compound condition in one expression, such as flag || x > 0.5. Send the result to a switch or gate condition.

Usage tips

  • Keep a simple comparison that needs only one compare as a node. Once two or more conditions interact, consolidating them here makes the graph easier to read.
  • Because time / frame are available, one expression can describe temporal conditions such as "true only on certain frames" (for example, frame % 4 == 0).
  • This also works as a test bench for a list_filter predicate because it uses the same expression syntax.

Related nodes

  • compare / value_match — use nodes for simple decisions
  • switch / gate — destinations for the Bool value
  • expression_float / expression_vec2 — other types using the same expression engine
  • list_filter — list-based conditional expressions

Read this first

  • The x, y, vec, and flag names here are separate from variables created in the Variables panel.
  • They are the input pin names of the Expression node itself.
  • You can also enter x, y, vec_x, vec_y, and flag directly in the Inspector.
  • To use a variable from the Variables panel, retrieve it with Variable Ref or a similar node and connect it to the relevant input pin.
  • When a value is connected to an input pin, the input-pin value takes precedence over the Inspector value.
  • Unconnected inputs use the following values:
    • x, y = 0
    • vec = [vec_x, vec_y]
    • flag = false

Available features

  • Variables: x, y, vec, vx, vy, flag, time, frame, total_frames
  • Operators: + - * / %, == != < <= > >=, && || !
  • Functions: min, max, clamp, abs, floor, ceil, round, sign, sin, cos, tan, sqrt, pow, lerp, vec2, x, y, length, if

Common expressions

  • x < 0.5
  • flag || x > 0.5
  • length(vec) >= 4

Concrete examples

Example 1: Threshold test

  • Set x to 0.25
  • expression = x < 0.5
value = true

Example 2: Compound condition

  • Set flag to false
  • Set x to 0.8
  • expression = flag || x > 0.5
value = true

When to use it

  • When you want to produce a Bool for a Switch or filter condition with only a lightweight expression
  • When you want to test a List Filter predicate on its own first

Notes

  • && / || skip the right side once the result is known. if(condition, A, B) evaluates only the selected branch, so an error in the unselected branch does not affect the result.
  • Numeric rules match the Math nodes: reversed clamp bounds are swapped, sign(0) = 0, and % is a non-negative Euclidean remainder. Division or modulo by zero and sqrt of a negative value produce an error.
  • Values other than Bool can be evaluated, but the final result is converted to true / false.
  • This is not intended for writing complex state machines.
  • While you type an expression, the incomplete intermediate text is evaluated immediately, so an error may appear temporarily.
Back to Node List