The information in this article applies to:
SYMPTOMSIf you write a FOR loop with an INTEGER or LONG variable as the FOR loop counter and use a floating point value less than or equal to 0.5 as the FOR loop increment, the loop never terminates. This causes the computer to hang (stop responding to input). CAUSEAll Basic programs convert floating point values less than 0.5 to the integer value 0. RESOLUTIONTo stop a program that is executing in this type of an endless loop, press CTRL+BREAK. STATUSThis behavior is by design. In other words, this is not a problem with the FOR statement; this is the way Basic is designed to operate. MORE INFORMATIONSteps to Reproduce Behavior in Visual Basic for Windows
To change this example program so that the loop terminates, change the type of the counter variable from LONG to SINGLE (change j& to j!). Additional query words: 1.00 2.00 4.00 4.00b 4.50 7.00 7.10 b_quickbas b_basiccom
Keywords : |
Last Reviewed: January 25, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |