232showtime Posted August 8, 2016 Posted August 8, 2016 (edited) Good day, is it possible to make a For Loop infinite, ho do i make a for loop infinite??? using the script below For $i = 0 To 10 Msgbox(64, "Succes", $i) Next Edited August 8, 2016 by 232showtime ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon.
Moderators Melba23 Posted August 8, 2016 Moderators Posted August 8, 2016 232showtime, Use a While...WEnd loop - but you will need to have some way of exiting it at some point. M23 232showtime 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Danyfirex Posted August 8, 2016 Posted August 8, 2016 Hello. As Melba says Correct way is using While. But a for can be infinite this way. For $i = 0 To 1 Msgbox(64, "Succes", $i) $i-=1 Next Saludos kcvinu and 232showtime 2 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
232showtime Posted August 8, 2016 Author Posted August 8, 2016 @Melba23 noted... @Danyfirex wow this is really something. thanks for sharing. ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon.
jchd Posted August 8, 2016 Posted August 8, 2016 BTW you can also run an unbounded loop with Do..Until This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
czardas Posted August 8, 2016 Posted August 8, 2016 (edited) @jchd There's only one type of loop right? Do Until False Warning: Loop will run infinitely. Add a sleep value, or some other code, within the loop to prevent cpu overheating. Edited August 8, 2016 by czardas operator64 ArrayWorkshop
jchd Posted August 8, 2016 Posted August 8, 2016 Yes and since a so-called "infinite loop" has no exit condition, all forms are equivalent: a linear code block terminated by a backward branch. Note that the term infinite has zero practical meaning in computer science, since noone can reasonably expect anything being infinite in the real world. Abstract mathematical objects actually infinite aren't defined by means of an infinite loop. It remains that Do..Until seems to be underused in code regularly posted, compared to While..Wend, without good reason in many situations. There is no theoretic grounds to infer that more than half of useful algorithms need to check exit condition at inner code block entry (While) or exit (Until). czardas 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Gianni Posted August 8, 2016 Posted August 8, 2016 one more way is setting Step = 0 (just for fun) Local $end For $i = 0 To 0 Step 0 ConsoleWrite($i & @CRLF) ; ..... $end += 1 If $end = 10 Then $i = 1 ; to exit set $i > of the To value Next 232showtime 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
czardas Posted August 8, 2016 Posted August 8, 2016 1 hour ago, jchd said: It remains that Do..Until seems to be underused in code regularly posted I agree with you. I was inferring that all loops in programming do pretty much the same thing: in so much as they repeat until a condition is met, or not. The comment was a follow up on your earlier post and I thought it worth a mention. Implementation may vary of course. I imagine loops which increment an iteration count ought theoretically be slower. It stands to reason, although in the real world things might not be so straight forward. operator64 ArrayWorkshop
jchd Posted August 8, 2016 Posted August 8, 2016 My remark was more towards whether preconditions or postconditions dominate in loop constructs. Given a significant sample of distinct general-purpose algorithms, the ratio is close to 1/2, while in common code people tend to code While <cond> ... Wend with <cond> always true at entry. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
czardas Posted August 9, 2016 Posted August 9, 2016 (edited) I meant to answer, but fell asleep. I was thinking it might be a good idea to get rid of the condition altogether and just simply have the loop. Terms like 'While', 'For' and 'Until' are rather specific. I'm speaking more generally in terms of language design - not necessarily AutoIt. Edited August 9, 2016 by czardas operator64 ArrayWorkshop
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now