ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Errors / WLanguage errors
  • Reason
  • Tip
  • Examples
  • 1. Using the LOOP statement without a BREAK statement
  • 2. Using the WHILE statement without condition and without BREAK statement
  • 3. Loop used to get information about a serial port
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Warning 18: Loop without potential end
Reason
A LOOP or WHILE statement is used in the current code. No statement is used in this code to force the exit from the loop: a deadlock may occur.
Tip
Check whether your loop is not an endless loop and whether it is possible to force the exit from the statement block (by using the BREAK statement for example).
Examples

1. Using the LOOP statement without a BREAK statement

Code triggering the warning
LOOP
// read a line in the text file
ALine = fReadLine(FileNum)
ProcessLine(ALine)
END
Possible correction
Add a line used to process the exit from the loop (in this example, code used to find out whether the end of the file was reached).
LOOP
// read a line in the text file
ALine = fReadLine(FileNum)
IF ALine = EOT THEN BREAK
ProcessLine(ALine)
END

2. Using the WHILE statement without condition and without BREAK statement

Code triggering the warning
WHILE ALine<>EOT
// read a line in the text file
ALine = fReadLine(FileNum)
ProcessLine(ALine)
END
Possible correction
Add a line used to process the exit from the loop (in this example, code used to find out whether the end of the file was reached).
WHILE ALine<>EOT
// read a line in the text file
ALine = fReadLine(FileNum)
IF ALine = EOT THEN BREAK
ProcessLine(ALine)
END
WEBDEV - Server codeWindowsNative Connectors (Native Accesses)

3. Loop used to get information about a serial port

Code triggering the warning
// Event calling a procedure.
// The EndProgram function is used in this procedure
LOOP
// Loop process to retrieve the information
Multitask()
END
Possible correction
No correction is required. EndProgram is used to end the process.
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help