Hi All,

Simple calculation and have trouble when it is negative number

I have this and

- Is there better way to calculate the Balance?
- Do I have to change negative to positive number?

Code:`'add number`

a = 542

b = -211 'negative number

c = 186

d = 374

x = a+b+c+d 'Get total -- ok

'get the balance

'balance = a - b 'It is wrong result when the number is negative. Unknown negative number or not

if b < 0 then

'msgbox("b is less than 0 and ...")

'How to change to positive number?

balance = a + b 'Unknown negative number or not

else

balance = a - b 'Unknown negative number or not

end if

ui_msg_box("result","balance "+balance)