Results 1 to 2 of 2

Thread: Usage of EXIT

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Usage of EXIT

    Hi,

    some EXIT statement sample:
    [code=thinbasic]
    uses "Console"

    dim i as long

    ' -- Classic usage of jumping out of DO/LOOP
    Console_WriteLine "DO / LOOP exit:"
    DO

    incr i

    Console_WriteLine "DO -> (i="+FORMAT$(i)+")"

    if i = 7 then exit do

    Console_WriteLine "LOOP <-"

    LOOP
    Console_WriteLine "DO / LOOP exit ended..."
    Console_WriteLine "Press ENTER to continue..."
    Console_ReadLine

    ' -- Advanced jump from higher level loop
    Console_WriteLine "DO / LOOP exit from nested FOR/NEXT:"
    do
    Console_WriteLine "DO ->"

    for i = 1 to 10

    Console_WriteLine "FOR/NEXT i="+FORMAT$(i)
    if i = 5 then exit do ' -- We are in FOR/NEXT block, but we can jump out from the DO/LOOP here too !

    next

    Console_WriteLine "LOOP <-" ' -- This line will never be executed
    loop

    Console_WriteLine "DO / LOOP exit from nested FOR/NEXT ended..."
    Console_WriteLine "Press ENTER to quit..."
    Console_ReadLine
    [/code]

    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Usage of EXIT

    Got it.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •