-1

Does VB.Net have true and false operators like C# does?

Until this morning, I was not aware that C# has true and false "operator"s.
I found them listed in a book, along with the normal operators (&, ^, |, &&, etc.). At first I thought it was a misprint; I thought that true and false were only Boolean values, not operators.
I found this MSDN page: true Operator (C# Reference) about C#'s true operator, but was unable to find anything about VB's True operator (if it even exists).

Mark Hurd
  • 10,665
  • 10
  • 68
  • 101
  • Please expand what you mean by True and False operators – Matt Wilko Nov 03 '15 at 12:01
  • 4
    [`True`](https://msdn.microsoft.com/en-us/library/f0y616xy(v=vs.90).aspx) and [`False`](https://msdn.microsoft.com/en-us/library/75k39e8h(v=vs.90).aspx) are the two possible values of the [`Boolean` DataType](https://msdn.microsoft.com/en-us/library/wts33hb3(v=vs.90).aspx) – Tim Schmelter Nov 03 '15 at 12:03
  • Possible duplicate of [Why C# fails to compare two object types with each other but VB doesn't?](http://stackoverflow.com/questions/14837209/why-c-sharp-fails-to-compare-two-object-types-with-each-other-but-vb-doesnt) – kenorb Nov 03 '15 at 12:05
  • 1
    @kenorb: very far-fetched – Tim Schmelter Nov 03 '15 at 12:07
  • Thanks for your comments. Sorry for the lack of explanation in my question before. I've edited it now. – JohnStossel256 Nov 03 '15 at 17:07

2 Answers2

1

Yes, it has the IsTrue and IsFalse overload operators.

Mark Hurd
  • 10,665
  • 10
  • 68
  • 101
0

Sure, they are True and False.

But note that True in VB.NET evaluates to -1.

VB.NET also has the logical operators Not, And, Xor, &c.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483
  • Thank you for your answer. Are they used the same as in C#? [true Operator (C# Reference)](https://msdn.microsoft.com/en-us/library/6x6y6z4d(v=vs.110).aspx) – JohnStossel256 Nov 03 '15 at 17:12
  • 1
    You probably caught this, but I'm meaning operators, not just Boolean values. (I should have explained my question better originally). So, if there really are VB True and False operators, then I will mark your answer (as answer). Thanks again. – JohnStossel256 Nov 03 '15 at 17:22
  • The logical operators I cite are broadly equivalent to the c# operators. – Bathsheba Nov 03 '15 at 17:48
  • Thank you! Due to lack of reputation points, S.O. does not yet allow me to mark answer. – JohnStossel256 Nov 03 '15 at 19:51