victor Posted November 8, 2005 Share Posted November 8, 2005 (edited) How to change an int from positive to negetive? example -4 to 4 thanks in advance Edited November 8, 2005 by victor Link to comment Share on other sites More sharing options...
themax90 Posted November 8, 2005 Share Posted November 8, 2005 $Variable = -4 MsgBox(0, "Before Switch", "Your Variable Before Switch Is " & $Variable) $Variable = PosNegSwitch($Variable) MsgBox(0, "Before Switch", "Your Variable After Switch Is " & $Variable) Func PosNegSwitch($Var) $Var = ($Var * -1) Return $Var EndFunc Link to comment Share on other sites More sharing options...
victor Posted November 8, 2005 Author Share Posted November 8, 2005 thanks Link to comment Share on other sites More sharing options...
themax90 Posted November 8, 2005 Share Posted November 8, 2005 No Problem, if you knew some basic Algebra you would know any number times -1 will result in the oposite signs of the same number. For example: 5 x -1 = -5 -5 x -1 = --5(Which two negitives make positive) = +5 or 5 Very simple, you just had to reorganize it into a variable line. Thanks for asking your question, I'm glad I could help. AutoIt Smith Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now