I want to find the difference between two numbers in Go and the result should not be in "-".
Please find my code below:
dollarValue := 240000 - 480000
The result is "-240000". But my expected output is just "240000". Can anybody help on how to calculate the difference between these two numbers.
Your title is misleading. It should be states without negative
instead of - operator
.
Basically what you want to get is the absolute different between two numbers
You have two options:
math.Abs
(need to convert from/to float)