Jump to content

How to change an int from positive to negetive?


victor
 Share

Recommended Posts

$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

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. B)

Thanks for asking your question, I'm glad I could help.

AutoIt Smith

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...