Nella tabella seguente sono elencati le descrizioni e i simboli degli operatori aritmetici.
Tabella 11-2 Operatori aritmetici
| Descrizione | Simboli |
|---|---|
| Elevamento a potenza | ^ |
| Negazione unaria o sottrazione | - |
| Moltiplicazione | * |
| Divisione | / |
| Divisione con resto | \ |
| Aritmetica modulare | Mod |
| Addizione | + |
| Concatenazione di stringhe | & |
Negli esempi seguenti viene illustrato l'uso degli operatori aritmetici.
Esempio 1
Dim Positive, Negative Positive = 5 Negative = -Positive ' Unary Negation: -5
Esempio 2
Dim Dividend, Divisor, IntQuotient Dividend = 20 Divisor = 3 IntQuotient = Dividend \ Divisor ' Integer Division: 20 \ 3 '20 \ 3 = results 6