跳至主要内容

评估节点

Evaluate Node Screenshot

概述

评估节点对输入值执行数学运算并输出结果。它支持多种运算,包括加法、减法、乘法、除法、指数运算、取模、绝对值和取反。

输入项

标题数据类型描述默认值备注
AnumberThe first operand for the operation.(Required)The input will be coerced into a number if it is not a number.
BnumberThe second operand for the operation.(Required for binary operators)The input will be coerced into a number if it is not a number.

示例1:执行简单的加法运算

  1. 创建一个Evaluate节点并将Operation设置为+
  2. 创建两个Number节点,将它们的值分别设置为23
  3. 将数值节点连接到Evaluate节点的AB输入端口。
  4. 运行图形。Evaluate Node 的输出应为 5

Evaluate Node Example 1

错误处理

如果操作失败(例如,如果您尝试除以零),Evaluate节点将会报错。

常见问题

问:如果我想根据输入执行不同的操作怎么办?

A: 您可以使用Operation输入端口根据输入动态更改操作。输入将被强制转换为字符串,并且必须匹配支持的操作之一。

另请参阅