UInt8 Data Type
Holds unsigned 8-bit (1-byte) integer values in the range 0–255.
Instructions
- Default value
- When you declare a variable of type
UInt8and do not initialize it, its default value is zero (0). - Negation
If you use the negation operator (
-) on an unsigned type, ViviFire gives a warning that this operation is usually an error.If you subtract a larger number from a smaller number, you find the result as follows:
number Mod UInt8.Max + 1- Automatic conversions
UInt8widens toInt16,UInt16,Int32,UInt32,Int64,UInt64,Int128,UInt128,Real32,Real64, orReal128without risk of overflow.- Type characters
- You can put the suffix
u8(orU8) on the end of an integer literal. But there are no type characters for names.
Shared methods and properties
UInt8.Default As UInt8- Returns the default value,
0. UInt8.Max As UInt8- Returns the maximum positive value.
UInt8.Min As UInt8- Returns the minimum value. This is always zero (0)
UInt8.Parse(str As String, Optional #format As Format) As UInt8- Tries to parse a string that shows as an integer.
- If
#formatis not given or is#Null, it tries to parsestras a decimal (base-10) integer. Or you can make it clear withFormat.Base10. UInt8.Size As Int32- Returns the number of available bytes. This is always one (1).
Examples
Example 1
Dim foo As UInt8
Example 2
Var low = 0u8, high = 100u8
Var result = low - high
low |
0 (%X00) |
|---|---|
high |
100 (%X64) |
result |
156 (%X9C) |