UInt16: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: UInt16
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Back to [[Data type|data types]]. | |
| 2 | + | ||
| 3 | + | Range of values: 0 .. 65535 | |
| 4 | + | ||
| 5 | + | Memory requirement: 2 bytes or 16 bits | |
| 6 | + | ||
| 7 | + | A [[Data field|data field]] of the **UInt16** data type can only contain positive integer values. Assigning other values leads to compiler error messages when the program is compiled and the compilation process is aborted. That is, the executable program is not created. | |
| 8 | + | ||
| 9 | + | Definition of a data field of type UInt16: | |
| 10 | + | ||
| 11 | + | ``` pascal | |
| 12 | + | var | |
| 13 | + | ui16 : uint16; | |
| 14 | + | ``` | |
| 15 | + | ||
| 16 | + | Examples of assigning valid values: | |
| 17 | + | ||
| 18 | + | ``` pascal | |
| 19 | + | ui16 := 0; | |
| 20 | + | ui16 := 65535; | |
| 21 | + | ``` | |
| 22 | + | ||
| 23 | + | Examples of assigning invalid values: | |
| 24 | + | ||
| 25 | + | ``` pascal | |
| 26 | + | ui16 := '0'; | |
| 27 | + | ui16 := '32767'; | |
| 28 | + | ``` | |
| 29 | + | ||
| 30 | + | The difference between the two examples is that the upper example is the assignment of literals of the type [[Integer]], while the assignment of the lower example is literals of the type [[String]]. | |
| 31 | + | ||
| 32 | + | --- | |
| 33 | + | *From the Free Pascal wiki, page "UInt16", as it stood on 2020-03-01 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
