WLJS LogoWLJS Notebook

BitSet

BitSet[n, k] sets to 1 the bit corresponding to the coefficient of 2^k in the integer n.

Examples

Set the 3rd bit:

BitSet[0, 3]
(* 8 *)

Set a bit in an existing integer:

BitSet[5, 1]
(* 7 *)

Please visit the official Wolfram Language Reference for more details.

On this page