Bset Function

Purpose

Sets one bit in an integer expression or variable.

Syntax

I = Bset(m, n)

Bset ivar, n

m, n:iexp
ivar:ivar

Description

Bset(m, n) sets the n-th bit in the integer expression m and returns the new value.

Example

OpenW # 1

Dim i% = 10                           //  10 => 1010

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

Bset i%, 2 : Print Bin$(i%, 4)        // Prints 1111

See Also

Bclr(), Btst(), Bchg()

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