UInt16
Data Type
Holds unsigned 16-bit (2-byte) integer values in the range 0–65535.
Instructions
- Default value
- When you declare a variable of type
UInt16
and 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 UInt16.Max + 1
- Automatic conversions
UInt16
widens toInt32
,UInt32
,Int64
,UInt64
,Int128
,UInt128
,Real32
,Real64
, orReal128
without risk of overflow.- Type characters
UInt16
has no type characters.
Shared methods and properties
UInt16.Default As UInt16
- Returns the default value,
0
. UInt16.Max As UInt16
- Returns the maximum positive value.
UInt16.Min As UInt16
- Returns the minimum value. This is always zero (0)
UInt16.Parse(str As String, Optional #format As Format) As UInt16
- Tries to parse a string that shows as an integer.
- If
#format
is not given or is#Null
, it tries to parsestr
as a decimal (base-10) integer. Or you can make it clear withFormat.Base10
. UInt16.Size As Int32
- Returns the number of available bytes. This is always 2.
Examples
Example 1
Dim foo As UInt16
Example 2
Dim low As UInt16 = 0, high As UInt16 = 100
Dim result As UInt16 = low - high
Variable | Value |
---|---|
low | 0 (%X0000) |
high | 100 (%X0064) |
result | 65436 (%XFF9C) |