Skip to content

Boolean Types

Boolean types represent logical truth values.

Module: Std

Summary

ToString(value: bool8) -> String
ToString(value: bool16) -> String
ToString(value: bool32) -> String

bool8.ToString() -> String
bool16.ToString() -> String
bool32.ToString() -> String

Description

Rux provides multiple boolean types with different storage sizes:

Type Size
bool8 8 bits
bool16 16 bits
bool32 32 bits

All boolean types represent the same logical values:

true
false

The primary difference between them is storage size.

All boolean types implement the Display interface and can be used with formatting and output functions.


String Conversion

ToString

bool8

ToString(value: bool8) -> String

bool16

ToString(value: bool16) -> String

bool32

ToString(value: bool32) -> String

Converts a boolean value into its string representation.

Return Values

Boolean Value Result
true "true"
false "false"

Example

let text = ToString(true);

Result:

true

Display Implementation

All boolean types implement the Display interface.

extend bool8 : Display
extend bool16 : Display
extend bool32 : Display

This allows boolean values to be used with APIs accepting Display.

Example

PrintLine(true);

Output:

true

Formatting

Boolean values can be used with Format().

Example

let text = Format(
    "Enabled: {}",
    true
);

Result:

Enabled: true

Notes

  • All boolean types behave identically.
  • The only difference between bool8, bool16, and bool32 is storage size.
  • String conversions always produce lowercase output.
  • A new string is allocated for each conversion.