mardi 14 juin 2016

How does If 1 = 2 = 3 Then (...) work

While coding in VB.NET i accidently wrote something like this into my code;

Dim a as integer = 1
Dim b as Integer = 2
Dim c as Integer = 3
If a = b = c Then
 '.. some Code
End if

It did not give me an error so it looks like it is a part of the programming language (or programming itself) that I do not know.

My Question:

How does this statement work and what are good examples for a use-case of this code?


Edit:

Dim a as Integer = 1 = 2 = 3

This line also does not give me an error. MsgBox(a) shows me a 0

Aucun commentaire:

Enregistrer un commentaire