VB.NET Operators
Operators are symbols that tell the compiler to perform specific mathematical, relational, or logical operations and return a result. Below is a quick reference for the most common operators used in VB.NET.
Category | Operator | Example | Description |
---|---|---|---|
Arithmetic | +, -, *, /, ^, Mod | 5 + 3 |
Addition, subtraction, multiplication, division, exponentiation, remainder. |
Assignment | =, +=, -=, *=, /=, ^=, Mod= | count += 1 |
Assigns a value to a variable, optionally performing an operation. |
Comparison | =, <>, <, >, <=, >= | a <> b |
Evaluates equality or order between two expressions. |
Logical | And, AndAlso, Or, OrElse, Not, Xor | flag And Not otherFlag |
Boolean logic operators. AndAlso and OrElse short‑circuit. |
String Concatenation | & | "Hello " & "World" |
Combines two strings into one. |
Type Conversion | CInt, CDbl, CStr, CBool, CType | CInt("42") |
Explicitly converts an expression to another data type. |
Try It Live
Enter a short VB.NET expression below and click Run to see the result. (Only a safe subset of expressions is supported.)