Page 1 of 1
					
				[Implemented] NOT (or !) operator
				Posted: Wed May 07, 2003 4:11 am
				by Amiga5k
				So we can do If Not OpenConsole() etc. instead of If OpenConsole() = #FALSE...
I know it's easy enough to do:
Code: Select all
Procedure Not(expression)
   If expression
      ProcedureReturn #FALSE
   Else
      ProcedureReturn #TRUE
   Endif
EndProcedure
If Not(OpenConsole())...
But it would be nice. Or possibly using '!' instead of Not (too C-Like?)
Just a tiny wish. 
Russell
 
			 
			
					
				Re: NOT (or !) operator
				Posted: Wed May 07, 2003 8:45 am
				by tinman
				Amiga5k wrote:Or possibly using '!' instead of Not (too C-Like?)
We already have ! for XOR :)
 
			 
			
					
				
				Posted: Wed May 07, 2003 9:38 am
				by Pupil
				PureBasic already has the bitwise NOT operator, it's just not the usual character '!' as in many other languages, in PB it's the '~' sign. It's in the manual under the section that says "Variables, Types and operators".
Edit: Sorry that wasn't what you were asking for, why not use this instead of logical NOT:
Code: Select all
if <expression> = 0 ; same as 'if NOT <expression>'
 
			 
			
					
				
				Posted: Wed May 07, 2003 4:37 pm
				by geoff
				Logical not makes code clearer.
Code: Select all
found=search_file_for_string(file$,a$)
If NOT found
  etc
  etc
EndIf
 
			 
			
					
				
				Posted: Fri May 09, 2003 9:22 pm
				by Amiga5k
				[quote]
Edit: Sorry that wasn't what you were asking for, why not use this instead of logical NOT: 
Code: Select all
if <expression> = 0 ; same as 'if NOT <expression>' 
[\code]
[\quote]
I do already (although I prefer If <expression> = #FALSE), but I got used to 'Not' in other languages and kinda liked it. It's simple enough to write a Not procedure, but just thought I'd throw this idea out there, too.
And Tinman, you're right about the '!' operator :( No big deal. I just use the Not procedure to do it:
[code]
If Not(<expression>)
   ...
Else
   ...
EndIf
[\code]
Russell
 
			 
			
					
				
				Posted: Fri May 30, 2003 10:05 pm
				by Revolver
				Personally I can't believe that a logical NOT was left out of PureBasic in the first place... What was Fred thinking!
			 
			
					
				
				Posted: Sat May 31, 2003 10:05 pm
				by Amiga5k
				I forgive him. He's got other fish to fry 

 I'm sure he will add it as soon as he can. In the mean time, it's easy to get around it. Talk about omissions, all three versions of Blitz are missing Val() 

 and Int() works in a completely different way than all other basics' versions of Int(). So I can do without the Not statement for now, really. 
btw, I think Fred is supposed to have the new version of PB up June 1st!
Russell
 
			 
			
					
				
				Posted: Tue Jun 10, 2003 3:36 am
				by flim
				I would like to see logical Not and also "break" and "continue" keyword for loop.