Jump to content
Sign in to follow this  
Hassan

Loops & confusion in my mind

Recommended Posts

Hassan

I am facing a big confusion in my mind related to "For" & "While" loop give me a little idea about both these two loops. more over If I start a loop with while and then give conditions like as follow, just tell me is it the proper way to do that or I should do something else

While

If

("ABC") Then

Winexit("vhvsh")

Endif

If

("GHT") Then

Winexit("pieoph")

Endif

If

("4545") Then

Winexit("kjqhjq")

Endif

and next time an other string with another function but again in If used & it close & End if & again & again between While loop is Ok or I should try something different to make my source code a little small

WEnd

Share this post


Link to post
Share on other sites
martin

I am facing a big confusion in my mind related to "For" & "While" loop give me a little idea about both these two loops. more over If I start a loop with while and then give conditions like as follow, just tell me is it the proper way to do that or I should do something else

While

If

("ABC") Then

Winexit("vhvsh")

Endif

If

("GHT") Then

Winexit("pieoph")

Endif

If

("4545") Then

Winexit("kjqhjq")

Endif

and next time an other string with another function but again in If used & it close & End if & again & again between While loop is Ok or I should try something different to make my source code a little small

WEnd

For loops let you execute a set of instructions a fixed number of times. A while loop keeps executing the code untill the condition is not true any more, which could never happen. You could have

If $string1 = "abcd" then
 do something
EndIf

The example you gave wouldn't actually work in AutoIt because a non empty string will evaluate to true. (Even "0") But otherwise the construction you showed is ok.

I can't answer the last sentence of your post because I don't understand it.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.