PRB: For Loop w/ Integer Counter & Increment <=.5 Causes Hang (87769)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 2.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
- Microsoft Visual Basic Standard Edition for Windows 1.0
- Microsoft QuickBASIC 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBASIC 4.5
- Microsoft Basic Professional Development System for MS-DOS 7.0
- Microsoft Basic Professional Development System for MS-DOS 7.1
This article was previously published under Q87769 SYMPTOMS
If 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).
CAUSE
All Basic programs convert floating point values less than 0.5 to the
integer value 0.
RESOLUTION
To stop a program that is executing in this type of an endless loop,
press CTRL+BREAK.
STATUS
This 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.
Modification Type: | Minor | Last Reviewed: | 8/16/2005 |
---|
Keywords: | kbprb KB87769 |
---|
|