Page 1 of 1

How to use "global" inside IF statements ?

Posted: 03 Jun 2023, 22:05
by xMaxrayx
Hi, I made a global variable, and idk how to use the "IF" statement with it without making a new local variable.

I tired this and I got error with this code

Code: Select all

if (global aa=1)

I tried this looks strange idk if it works but no error msg

Code: Select all

 global  
            if ( aa=1)
                {
                    Send "^{End}"
                    return
                }
but with "else if" give me err

Code: Select all

   
   global  
   else if (aa=2)
                {
                    Send ("{Right 3}{Space}")
                    
                    return
                }

Re: How to use "global" inside IF statements ?  Topic is solved

Posted: 03 Jun 2023, 23:00
by swagfag
if ure only ever gonna read the variable(as seems to be the case based on the code uve shown so far), then u dont need to declare anything global

otherwise, write global aa somewhere before the beginning of ur if-elif-else block

Re: How to use "global" inside IF statements ?

Posted: 04 Jun 2023, 05:01
by xMaxrayx
@swagfag
Oh, I see thank you so much.