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:
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¶
bool16¶
bool32¶
Converts a boolean value into its string representation.
Return Values¶
| Boolean Value | Result |
|---|---|
true |
"true" |
false |
"false" |
Example¶
Result:
Display Implementation¶
All boolean types implement the Display interface.
This allows boolean values to be used with APIs accepting Display.
Example¶
Output:
Formatting¶
Boolean values can be used with Format().
Example¶
Result:
Notes¶
- All boolean types behave identically.
- The only difference between
bool8,bool16, andbool32is storage size. - String conversions always produce lowercase output.
- A new string is allocated for each conversion.