Question How to set variable opposite value (3.5)

hurdy

Member
Joined
Mar 24, 2011
Messages
5
Programming Experience
Beginner
Good evening,

I can remember reading some time ago that there is some way to set the opposite value of a variable depending on the value that it is set to but, I can't remember the syntax of it and I'm not sure what the correct terminology is to describe what I'm looking for.

Suppose that I have a boolean variable that can be either true or fule. I need to some way set the variable to the opposite value that is set.

Off of the top of my head it was written something like this (excuse the wrong syntax below, it's what I'm trying to figure out :) ).

VB.NET:
Dim myBool as Boolean = False
myBool = True : False

I know this can be done with if else statements but I'm sure I've seen a more compact way to write it.

Thank you for your time, and I appreciate any feedback give.

Rob
 
Thank you John. That's what I was looking for.

Thank you again for your help, I appreciate you taking the time out to help with this.
 
Back
Top