PowerShell Arithmetic Operators
In this tutorial we will see about PowerShell Arithmetic Operators and how PowerShell is dealing with them. Arithmetic operators are used to perform numeric calculations. As well as numeric calculations, the addition operator may also be used with strings, arrays, and hashtables. Multiplication operator may also be used with strings and arrays. Below is the list of PowerShell arithmetic operators. Operator Description Example + Adds numeric values 4 + 6 concatenates a string, arrays, and hash tables “CS” + “Tutorials” – Subtracts numeric values 4 – 2 Makes a number negative -98 * Multiple numeric values 4 * 2 copy string, arrays to the specified number of times “!” * 4 / Divides numeric values 4 / 2 % Gives remainder after division 7 % 3 For live demo, watch below video. I have demonstrated the use of PowerShell arithmetic operators by creating calculator. Along with operators, Switch statement and While loop also used.