Jump to content

Search the Community

Showing results for tags 'fornext'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello FellowForumers I have some questions about this subject and Although I have researched about i have some problems let it sink in proper Although i have basic understanding of Global and Local I Still have questions to be absolute sure: #include <Array.au3> Global $TSAB[20] While 1 trading() If $TSAB[19] = True Then MsgBox(0,"","Thank you AutoIT Forum ^^ ") ;~ If $TSAB[19] = True then Exit WEnd func trading() $TSAB[19] = "" $TSAB[7] = "" while 1 _ArrayDisplay($TSAB) $TSAB[7] = "done" _ArrayDisplay($TSAB) If $TSAB[7] = "Done" Then $TSAB = ClientDoneCommand() _ArrayDisplay($TSAB) If $TSAB[19] = True then Return $TSAB WEnd EndFunc func ClientDoneCommand() $TSAB[19] = True Return $TSAB EndFunc My own example Above gives to me Decent understanding that Global can be called anywhere in the program and that the global variable is sent and called towards other functions and loops as it was just before it got sent or returned is there anything I have to keep in mind to Prevent any big mess? Am I something missing about this or has anyone some advice? I will use this global as the soul of my program and store information on where it has been and been and what functions it has visit and what it has been doing etc Here I move to Local $var So I got the same script and added some Local var: #include <Array.au3> Global $TSAB[20] local $hugs = "" While 1 ConsoleWrite($hugs & "0" & @LF) ;Added line $hugs = trading() If $TSAB[19] = True Then MsgBox(0,"","Thank you AutoIT Forum ^^ ") ;~ If $TSAB[19] = True then Exit ConsoleWrite($hugs & "1" & @LF) ;Added line WEnd func trading() $TSAB[19] = "" $TSAB[7] = "" local $hugs = "yes" while 1 ConsoleWrite($hugs & "2" & @LF) ;Added line _ArrayDisplay($TSAB) $TSAB[7] = "done" _ArrayDisplay($TSAB) If $TSAB[7] = "Done" Then $TSAB = ClientDoneCommand($hugs) _ArrayDisplay($TSAB) ConsoleWrite($hugs & "4" & @LF) ;Added line If $TSAB[19] = True then Return $TSAB WEnd EndFunc func ClientDoneCommand($hugs) $TSAB[19] = True ConsoleWrite($hugs & "3" & @LF) ;Added line $hugs = "Maybe" Return $TSAB EndFunc Here I added a few console writes and numbered them the consolewrite output is 0 yes2 yes3 yes4 1 repeat So the following things I see in my blurry mind as are as follow at the very start I need to declare Local $hugs = "" else ; ConsoleWrite($hugs & "0" & @LF) ;Added line will have variable used before declaration (meaning nothing has been stored ever which I understand) Now here comes an interesting part to me, about: $hugs = trading() If $TSAB[19] = True Then MsgBox(0,"","Thank you AutoIT Forum ^^ ") ;~ If $TSAB[19] = True then Exit ConsoleWrite($hugs & "1" & @LF) ;Added line here Happens nothing , not even a error (which I expected) I do not get a consolewrite: 0 it does not output anything I understand that the functions has not returned the variable of local $hugs = "yes" or $hugs = "Maybe" But I expected an error, why no error? What Happens with the at line 33 $hugs = "Maybe" does it get lost? deleted (from the memory ) at the end of the function? @ line 17? local $hugs = "yes" Would it be wise to write there local $hugs = "yes" or is $hugs = "yes" Good enough , does it really matter with managing anything? and as last I also understand if I would change that at line 26 that it is not needed the write return $TSAB but just return would be good enough? because $TSAB is in every function / If / while for next loop avaiable and it will carry over the information stored inside of it? if i would change it into Return $hugs then ConsoleWrite($hugs & "1" & @LF) will give me yes1 and even at the very start of the while loop ConsoleWrite($hugs & "0" & @LF) will give me yes0 and it was previous just 0 so it seems anything wrong here? so it seems the local does not get lost at the end of the while loop then my final questions about for / next For $z = 0 to 9 For $x = 0 to 9 For $y = 0 to 9 ConsoleWrite($z & $x & $y & @LF) next next next if $z = 9 Then MsgBox(0,"","1000 ^^ ") if $x = 9 Then MsgBox(0,"","x = 9 ^^ ") if $y = 9 Then MsgBox(0,"","y = 9 ^^ ") the Variable $z , $x and $y are they only used in the for next loop or can they be used outside of it? my msgboxs do not work here after the next so i guess they end right away in the for next loop any tips or suggestions are welcome if i am saying anything wrong or retarded here Cheers Butterfly
×
×
  • Create New...