Skip to content

Constant

Constant emits its configured value on every step.

y = value

Port Direction Type
0 Output The selected type
Parameter Type Default
value Number, or true/false for bool 1.0
ty Type (f64, f32, i32 or bool) f64

These are the scalar types a Constant placed from the palette can take. The value is written for its type: 1 at i32, 1.0 at a float width. When you change the type, the value is reset to the new type’s zero.

A Constant placed on the canvas is a const item of the file, named by the block’s label: const one: f64 = 1.0; in the namespace, never a let in the step. Until a wire reads it, the block is only its placement. A wire writes the read by name (y = u + one;), and the block’s value, type and name edit the item.

Deleting an unread placement leaves the item, which the Values pane lists and removes. A constant declared in the namespace is placed the same way, and two placements of one constant are one block.

A named const item can also hold a composite value; its output has that composite type, and its value is edited as a whole.

With value = 2.5 and ty = f32, the output is y = 2.5 on every step.