Difference between revisions of "BYTE"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
Line 2: Line 2:
  
  
:::''Syntax:'' [[DIM]] variable [[AS]] [[_UNSIGNED]] '''_BYTE'''
+
:::''Syntax:'' [[DIM]] variable [[AS]] [ [[_UNSIGNED]] ] '''_BYTE'''
  
  

Revision as of 03:40, 7 October 2009

A signed _BYTE variable can hold variable values from -128 to 127 (one byte or 8 _BITs).


Syntax: DIM variable AS [ _UNSIGNED ] _BYTE


  • _UNSIGNED _BYTEs can hold values from 0 to 255. _UNSIGNED expands the range of positive values.
  • Can be defined in a QB64 _DEFINE statement using a starting letter range of variable names.
  • Also can be used in subroutine parameter AS variable definitions.


Example: How negative assignments affect the _UNSIGNED value returned by a byte(8 bits).

00000001 - unsigned & signed are both 1
01111111 - unsigned & signed are both 127
11111111 - unsigned is 255 but signed is -1
11111110 - unsigned is 254 but signed is -2
11111101 - unsigned is 253 but signed is -3


See also: _BIT, _DEFINE, _UNSIGNED, DIM, REDIM



Navigation:

Go to Keyword Reference - Alphabetical

Go to Keyword Reference - By usage