Dim Ans As Int
Dim Int1 As Int = 10
Dim Int2 As Int = 2
Ans = Int1 * Int2
Log("Your Answer Is: "&Ans)
' Division (/), Addition (+) and Subtraction (-) will work equally as well
Now, given the above, what would your answer be if:
Baffled - Has this got something to do with Intergers ? (2 to the base whatever I suppose)
If I change the Dim's to Long then I get the correct answer !!
And so many of us get caught out !!
Have a look here.
Int is 4 bytes signed so its range is -2147483648 to +2147483647; that means once it reaches one end it "wraps" to the other one ( 2147483647 + 1 = -2147483648).
Long type is 8 bytes long.
Have a look here.
Int is 4 bytes signed so its range is -2147483648 to +2147483647; that means once it reaches one end it "wraps" to the other one ( 2147483647 + 1 = -2147483648).
Long type is 8 bytes long.