QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _SHL function is used to shift the bits of a numerical value to the left.

Syntax

result = _SHL(numericalVariable, numericalValue)

Parameter(s)

Description

Availability

Example(s)


A~%% = 1 'set right most bit of an_UNSIGNED _BYTE
PRINT A~%%
PRINT _SHL(A~%%,7)
B~%% = _SHL(A~%%,8) 'shift the bit off the left 'edge'
PRINT B~%%


 1
 128
 0


A~%% = 1
FOR I%% = 0 TO 8
    PRINT _SHL(A~%%, I%%)
NEXT I%%


   1
   2
   4
   8
  16
  32
  64
 128
 256

See Also