Basic - Break statement: exit do, exit for, exit while

Used for the immediate interruption of the loop. after execution, will proceed with the following command after loop.

exit do

Description

exit do
Used keywords: do exit
Compatible programing languages:
Visual Basic .NET | FreeBASIC

Examples

Basic

Even one example in what situations we can use the operation break statement:
i=10
do
 i=i-1
 loop while i > 0
do
  i=i+1
  if i=5 then
    exit do
end if
loop while i <10

Basic

Other pieces of example codes:
if i=10 then
     exit do
   else
     i=i-1
   end if
if i=10 then
     exit do
   else
     i=i-1
   end if
if i=3 then
    exit do
end if

exit for

Description

exit for
Used keywords: exit
Note: Usable in the following locations:

Compatible programing languages:
Visual Basic .NET | FreeBASIC

Examples

Basic

Even one example in what situations we can use the operation break statement:
i=10
do
 i=i-1
 loop while i > 0
do
  i=i+1
  if i=5 then
    exit do
end if
loop while i <10

exit while

Description

exit while
Used keywords: while exit
Compatible programing languages:
Visual Basic .NET

Examples

Basic

Even one example in what situations we can use the operation break statement:
i=10
do
 i=i-1
 loop while i > 0
do
  i=i+1
  if i=5 then
    exit do
end if
loop while i <10
Languages: en hu cz sk