Just starting out? Need help? Post your questions and find answers here.
Konne
Enthusiast
Posts: 434 Joined: Thu May 12, 2005 9:15 pm
Post
by Konne » Sat Oct 07, 2006 9:22 pm
Is there an Operator which Switches a 1 into a 0 and a 0 into a 1?
It should do the same than this code:
Code: Select all
If Value=1
Value=0
Elseif Value=0
Value=1
EndIf
Apart from that Mrs Lincoln, how was the show?
netmaestro
PureBasic Bullfrog
Posts: 8452 Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada
Post
by netmaestro » Sat Oct 07, 2006 9:24 pm
Best available in PureBasic is a=1-a
BERESHEIT
jack
Addict
Posts: 1358 Joined: Fri Apr 25, 2003 11:10 pm
Post
by jack » Sat Oct 07, 2006 11:38 pm
SCRJ
User
Posts: 93 Joined: Sun Jan 15, 2006 1:36 pm
Post
by SCRJ » Sun Oct 08, 2006 12:37 am
Code: Select all
a = 1
a ! 1
Debug a
a ! 1
Debug a
blueb
Addict
Posts: 1121 Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico
Post
by blueb » Mon Oct 09, 2006 3:03 pm
Perhaps the Swap command is what you're looking for.
- It was too lonely at the top.
System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
naw
Enthusiast
Posts: 573 Joined: Fri Apr 25, 2003 4:57 pm
Post
by naw » Mon Oct 09, 2006 4:13 pm
this would be the NOT operator, wouldnt it?
Ta - N
Joakim Christiansen
Addict
Posts: 2452 Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:
Post
by Joakim Christiansen » Mon Oct 09, 2006 4:25 pm
SCRJ wrote: Code: Select all
a = 1
a ! 1
Debug a
a ! 1
Debug a
I think this methos is the best
I like logic, hence I dislike humans but love computers.
einander
Enthusiast
Posts: 744 Joined: Thu Jun 26, 2003 2:09 am
Location: Spain (Galicia)
Post
by einander » Mon Oct 09, 2006 4:35 pm
; some macros to switch values
Code: Select all
Macro Switch_1_0(n) ; switch between 1 and 0
1-n
EndMacro
Macro Switch_0_Minus1(n) ; switch between -1 and 0
n!-1
EndMacro
Macro Switch_1_2(n) ;switch between 1 and 2
3 - n
EndMacro