Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

If you say:

 

if not(a or b) Then

end if

 

logically, this statement would be,


if not A and not B Then

End if

 

but, contradictorily, wouldnt that turn into

 


if not A and B Then

End If

 

 

so basically, woundnt the Or change to an And when u remove the parenthesese

 

You may think im weird, but if you realy look into this logically, it would change..(or maybe im wrong)

 

but my other question is,

how would the compiler interpret it as?

 

thanks,

The Pentium Guy

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

  • Leaders
Posted

if you picture a Boolean then this is what's happening...

first case:

'/// if neither of the Booleans ( A and B ) are True
If Not A And B Then
   '///do something because both are False
End If

 

in the second case:

'/// if either a is False , or b is False
If Not(a Or b) Then
   '///do something because either a or b are False
End If

 

hope it helps clear things a bit.

Posted
Hopefully A and B are both Boolean type, because Option Strict would complain.

 

they are booleans.

 

thankks dynamic_soup

 

that did clear things up. So basically, when u removed the parenthesees, the Or changed to an And :)

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...