uCalc API Version: 2.1.3-preview.2 Released: 6/16/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

ValueByte()

Method

Product: 

Fast Math Parser

Class: 

Item

Retrieves the 8-bit unsigned integer (byte) value associated with a uCalc Item.

Syntax

ValueByte()

Parameters

[None]

Return

Byte

Returns the 8-bit unsigned integer (byte) value of the item.

Remarks

The ValueByte() method retrieves the value of a uCalc Item as an 8-bit unsigned integer (a byte, 0-255).

This accessor is specifically designed for variables that have been defined with the Byte or Integer_8u data type using DefineVariable. While you can call this method on an item of a different numeric type, the value will be cast, which may result in data loss or overflow if the original value is outside the 0-255 range.

This method is the getter counterpart to the setter, ValueByte(byte).

⚖️ Comparative Analysis

In statically-typed languages like C# or C++, a variable is declared with a fixed type at compile time (e.g., byte myValue = 10;). Accessing it simply involves reading the variable.

uCalc operates at runtime. A uCalc Item is a more flexible container that can hold various data types. The ValueByte() method provides a type-safe way to retrieve the underlying value as a byte, ensuring that the host application receives the data in the expected format. This is part of a family of type-specific accessors (like ValueInt32, ValueDbl, etc.) that provide strong typing within a dynamic environment.

Examples