DAY 040: _TOGGLEBIT
#5
Edit: This was a reply to mn. I was writing this while Steve was posting. My multiple toggle idea is similar to his, apparently, but I haven't coded a database that way before.
-----------------------
I have a two track mind, but getting a train of thought to run on either is darn near impossible these days...

Yeah one of the things that I haven't explored yet is using _TOGGLEBIT to keep track of multiple toggle conditions.

Code: (Select All)
DIM AS INTEGER a, b, c
DO
    INPUT "Press 1 for cat 2 for dog: "; a: a = a - 1: a = _TOGGLEBIT(a, 0)

    INPUT "Press 1 for happy 2 for sad: "; b: b = b - 1: b = _TOGGLEBIT(b, 1)

    INPUT "Press 1 for black 2 for white: "; c: c = c - 1: c = _TOGGLEBIT(c, 2)

    IF _TOGGLEBIT(b, 1) THEN PRINT "happy" ELSE PRINT "sad"
    IF _TOGGLEBIT(c, 2) THEN PRINT "black" ELSE PRINT "white"
    IF _TOGGLEBIT(a, 0) THEN PRINT "cat" ELSE PRINT "dog"
    PRINT
LOOP

Terrible example, but I really can't wrap my 'train' around anything more practical I'd use this with at the moment. (Edit: And then Steve posted his database management example.)

Pete
Reply


Messages In This Thread
DAY 040: _TOGGLEBIT - by Pete - 12-19-2022, 07:43 PM
RE: DAY 040: _TOGGLEBIT - by mnrvovrfc - 12-19-2022, 08:32 PM
RE: DAY 040: _TOGGLEBIT - by SMcNeill - 12-19-2022, 08:43 PM
RE: DAY 040: _TOGGLEBIT - by mnrvovrfc - 12-19-2022, 09:37 PM
RE: DAY 040: _TOGGLEBIT - by SMcNeill - 12-19-2022, 09:05 PM
RE: DAY 040: _TOGGLEBIT - by Pete - 12-19-2022, 09:17 PM
RE: DAY 040: _TOGGLEBIT - by SMcNeill - 12-19-2022, 09:47 PM
RE: DAY 040: _TOGGLEBIT - by Pete - 12-19-2022, 10:03 PM
RE: DAY 040: _TOGGLEBIT - by SMcNeill - 12-19-2022, 10:22 PM
RE: DAY 040: _TOGGLEBIT - by Pete - 12-19-2022, 10:30 PM
RE: DAY 040: _TOGGLEBIT - by SMcNeill - 12-19-2022, 10:42 PM
RE: DAY 040: _TOGGLEBIT - by bplus - 12-19-2022, 11:20 PM
RE: DAY 040: _TOGGLEBIT - by Pete - 12-19-2022, 11:22 PM
RE: DAY 040: _TOGGLEBIT - by Jack - 12-19-2022, 11:58 PM
RE: DAY 040: _TOGGLEBIT - by Pete - 12-20-2022, 01:11 AM
RE: DAY 040: _TOGGLEBIT - by vince - 12-20-2022, 01:59 AM
RE: DAY 040: _TOGGLEBIT - by OldMoses - 12-20-2022, 03:46 AM



Users browsing this thread: 9 Guest(s)