Julia uses similar binary operators for basic arithmetic operations as does mathematics or other programming languages. Most operators can be written in infix notation (that is, placed in between the values being computed). Julia has an order of operations that matches the common convention in mathematics.

For instance, the below code implements the quadratic formula, which demonstrates the `+`

, `-`

, `*`

, and `/`

operators for addition, subtraction, multiplication, and division respectively. Also shown is *implicit multiplication*, where a number can be placed directly before a symbol to mean multiplication; that is, `4a`

means the same as `4*a`

.

```
function solvequadratic(a, b, c)
d = sqrt(b^2 - 4a*c)
(-b - d) / 2a, (-b + d) / 2a
end
```

Usage:

```
julia> solvequadratic(1, -2, -3)
(-1.0,3.0)
```

This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0

This website is not affiliated with Stack Overflow