Bchg Function

Purpose

Changes the status of a bit in an integer expression.

Syntax

i = Bchg( m, n)( function)

Bchg v, n( command)

m, niexp
v:ivar

Description

Bchg( m, n) sets the n-th bit in the integer expression m to 1 (if this bit is 0), or to 0 (if this bit is 1).

Example

OpenW # 1

Dim i% = 10                           //  10 => 1010

i% = Bchg(i%, 0) : Print Bin$(i%, 4// Prints 1011

Bchg i%, 1 : Print Bin$(i%, 4)        // Prints 1001

See Also

Bclr(), Bset(), Btst()

{Created by Sjouke Hamstra; Last updated: 24/09/2014 by James Gaite}