Page 1 of 1

variable -1

Posted: 18 Mar 2018, 04:06
by 7lux
Hi

i have a variable card1, i need a msgbox that shows the variable -1
something like:

Code: Select all

card1=5
card2= %card1%-1
{
MsgBox, %card2%
}
this has to be very simple but i cant figure it out,
hope someone can solve this for me

Re: variable -1

Posted: 18 Mar 2018, 04:57
by BoBo
card1 := 5
MsgBox % card2 := card1 - 1

Re: variable -1

Posted: 18 Mar 2018, 07:46
by Odlanir
Or even

Code: Select all

card1 := 5
MsgBox % --card1
card1 := 5
MsgBox % card1 -=1

Re: variable -1

Posted: 18 Mar 2018, 13:48
by gregster
Or force an expression

Code: Select all

card1=5
card2= % card1 -1
MsgBox, %card2%
But variable assignment is here done with legacy syntax ( = )... better use the other suggested ways (expression syntax := )