Skip to content
Subhajit Sahu edited this page Jan 24, 2021 · 5 revisions

Toggle a bit. 📰 📘

Alternatives: toggle, toggleAs.
Similar: get, set, toggle.


toggle x i
-- x: an Int
-- i: bit index
import Bit exposing (..)

toggle 6 0
-- 7 (110,0 ⇒ 111)

toggle 6 1
-- 4 (110,1 ⇒ 100)

toggle 6 2
-- 2 (110,2 ⇒ 010)


References

Clone this wiki locally