Skip to main content

Max

This node returns the larger of two numbers.

The Max node compares two numeric values and outputs the maximum value.

The Max node takes two numeric inputs and returns whichever value is larger. This is useful for ensuring values don't fall below a minimum threshold or for comparison operations.

Inputs

Numbers

DataDescription
First NumberThe first number to compare (default: 0)
Second NumberThe second number to compare (default: 0)

Actions

SignalDescription
DoTriggers the maximum value calculation

Outputs

DataDescription
ResultThe larger of the two input numbers
SignalDescription
DoneTriggered when the calculation is complete

Usage

The Max node is commonly used for:

  • Setting minimum thresholds or boundaries
  • Comparison operations
  • Data validation and sanitization
  • Mathematical calculations requiring the larger value

Example Use Cases

  1. Value Clamping: Ensure a value doesn't go below a minimum (e.g., max(userInput, 0))
  2. Game Development: Calculate maximum damage, highest score, or level caps
  3. UI Controls: Set minimum widget sizes or positions
  4. Financial Logic: Compare prices, calculate maximum fees
  5. Data Processing: Find peak values in datasets

Examples

First NumberSecond NumberResult
535
-2-5-2
01010
7.57.27.5
-100

Error Handling

The node will log errors and not perform calculations if:

  • Either input value is not a valid number
  • Either input value exceeds the allowed range (-1 trillion to 1 trillion)
  • The result would exceed the allowed range

Mathematical Properties

  • Commutative: max(a, b) = max(b, a)
  • Associative: max(max(a, b), c) = max(a, max(b, c))
  • Identity: max(a, -∞) = a
  • Idempotent: max(a, a) = a