Operators and Expressions
5.2 Comparison Operators
= <> < > <= >= (note: = is both assignment and equality depending on context).
Is / IsNot compare object references: If obj IsNot Nothing Then.
TypeOf obj Is Type / TypeOf obj IsNot Type checks the type.
Like does pattern matching: If code Like "A##-*" Then (? = one char, * = any, # = digit, [a-z] = range, [!0-9] = not).
5.3 Logical Operators
❌ (evaluates both sides; also bitwise) Logical/bitwise AND, OR AndAlso / OrElse
Short-circuit logical AND, OR (prefer these) Logical/bitwise negation
If customer IsNot Nothing AndAlso customer.IsActive Then ' safe: second part only runs if the first is True5.4 String Operators
& concatenates (preferred). + also concatenates strings but can cause type confusion.
5.5 Assignment Operators
There are no ++ or -- operators. Use count += 1.
5.7 Other Operators
Dim result = If(score >= 50, "Pass", "Fail") ' ternary If operator (short-circuits)
Dim name = If(inputName, "Guest") ' null-coalescing (two-argument If)
Dim len = customer?.Name?.Length ' null-conditional (VB 14)
Dim first = items?(0) ' null-conditional index
Dim n = NameOf(customer) ' "customer"
Dim t = GetType(String) ' System.Type
Dim addr = AddressOf MyProcedure ' delegate to a method5.8 Operator Precedence (High → Low)
Unary -, + Comparison (=, <>, <, >, Is, IsNot, Like, TypeOf...Is) And, AndAlso Or, OrElse