SkysLastChance Posted August 8, 2019 Posted August 8, 2019 (edited) I am trying to figure out why my count is going to 2 after this Do... Until... Local $vTopCount = 1 Local $vBottomCount = 1 Local $vFindStart = 0 DO MsgBox(0,"",$vTopCount) If $vFindStart = 'X' Then $vTopCount = $vTopCount + 1 $vBottomCount = $vBottomCount + 1 EndIf Until $vFindStart = 0 MsgBox(0,"",$vTopCount) I would expect it to stay at one. :/ What am I missing here. Edited August 8, 2019 by SkysLastChance You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott
Moderators JLogan3o13 Posted August 8, 2019 Moderators Posted August 8, 2019 (edited) Take a look at this and you should see why (no pun intended): Local $vTopCount = 1 Local $vBottomCount = 1 Local $vFindStart = "y" DO MsgBox(0,"",$vTopCount) If $vFindStart = 'X' Then $vTopCount = $vTopCount + 1 $vBottomCount = $vBottomCount + 1 EndIf Until $vFindStart = 0 MsgBox(0,"",$vTopCount) Edited August 8, 2019 by JLogan3o13 SkysLastChance and Xandy 1 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Nine Posted August 8, 2019 Posted August 8, 2019 Try this too : Local $vFindStart = 0 MsgBox ($MB_SYSTEMMODAL,"",$vFindStart = 'X') Comparing number and string are rarely a good idea SkysLastChance 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
SkysLastChance Posted August 8, 2019 Author Posted August 8, 2019 (edited) The light bulb came on finally. Thank you! Local $vTopCount = 1 Local $vFindStart = 0 Do MsgBox(0,"",$vTopCount) If $vFindStart <> "" Then ;Will loop if anything is in cell $vTopCount = $vTopCount + 1 EndIf MsgBox(0,"",$vTopCount) Until $vFindStart = 0 Edit: Local $vTopCount = 1 Local $vFindStart = "X" Do MsgBox(0,"",$vTopCount) If $vFindStart <> "" Then ;Will loop if anything is in cell $vTopCount = $vTopCount + 1 EndIf MsgBox(0,"",$vTopCount) Until $vTopCount = 2 Edited August 8, 2019 by SkysLastChance Xandy 1 You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott
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