Code archives/Algorithms/k.i.s.s. toggle
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
Probably the absolute easiest way to toggle between two numbers. | |||||
;Toggle between 0 and 1: a = 0 Repeat Print a a = 1 - a ; <- The clever part! Forever ; Learned this from waaaaaaaay back in the ; Commodore 64 days... |
Comments
| ||
its even easier to jsut do a = not a :) |
| ||
Haa, but "a=not a" only works with the value 1. a=64-a toggles between 0 and 64 |
| ||
A little faster method: a = a xor 1 |
| ||
@rtur: please remove that thing in your sig which displays IP my ISP and my operating system + which version of IE. |
| ||
Yeah, @rtur. It goes over the recommended forum signature size: 80 pixels or 5 lines, if I recall correctly. |
| ||
not to mention an invasion of my privacy, who knows what else that thing is doing. |
| ||
It is only analyzing the the data your browser is sending. that's what every page statistic knows as well. |
| ||
Wouldn't it be faster to do Repeat Print 0 Print 1 Forever |
| ||
TomToad: ... You missed the whole point I'm guessing. |
| ||
2 Inner It show all info only to u...no one else know your ip,isp etc...;-) |
| ||
Could you still remove it, please? It's huge and annoying. |
| ||
...i like it. but i suppose if its anoying people, best to stay in the good books. |
| ||
"@rtur" doesn't appear to be doing it himself - looks like he is accessing the info via a 3rd party and relaying it in - I don't think it is malicious, but I would be a bit concerned that the data is being collated by a 3rd party website that he has nothing to do with. |
| ||
@rtur: I don't care, if it's telling me my entire life history, remove it please. |
| ||
3rd party can also grab email from outlook (and a few other mailbox programs as well now...) create SPAM for all... BAD @rtur... BAD... PLease remove it! oh and: musicflag=1 annoy=LoadSound("anoy1.ogg") LoopSound annoy Global play_annoy=PlaySound(annoy) while not keyhit(1) If KeyHit(50)>=1 Then musicflag=1-musicflag If musicflag=1 Then ChannelVolume play_annoy,0.4 Else ChannelVolume play_annoy,0 wendThis is how I use that toggle. Wolron and MAtty both showed me how to do this... it could be modified for any key on the keyboard to control anything... haven't tried it with combos yet! :] -Rook Zimbabwe |
| ||
Hmm, weird. I tried a benchmark using musicflag = 1 - musicflag and musicflag = not musicflag and the first version seems to be faster. |
| ||
I doubt this is going to be your primary bottleneck, guys. |
| ||
ok ppl, i've removed it... it was just fun signature..no collecting emails for spam or other bad things...just fun...:-( |
| ||
Thank you @rtur. I appreciate that you listened. |
Code Archives Forum