LB Booster
Programming >> Liberty BASIC language >> Exit or Return codes for LBB console programs?
http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1499994266

Exit or Return codes for LBB console programs?
Post by CirothUngol on Jul 14th, 2017, 01:04am

Is it possible to exit a compiled LBB program with a return code (equivalent to %ERRORLEVEL% in WinNT batch script)?
Re: Exit or Return codes for LBB console programs?
Post by Richard Russell on Jul 14th, 2017, 2:38pm

on Jul 14th, 2017, 01:04am, CirothUngol wrote:
Is it possible to exit a compiled LBB program with a return code (equivalent to %ERRORLEVEL% in WinNT batch script)?

I believe that currently the only way to do that in LBB is to invoke a BBC BASIC statement:

Code:
    !QUIT returncode 

If you compile this as a console application it sets %ERRORLEVEL% to the entered value:

Code:
    input "Enter required return code: "; returncode
    !QUIT returncode 

Richard.

Re: Exit or Return codes for LBB console programs?
Post by CirothUngol on Jul 15th, 2017, 04:00am

Yes, that is exactly what I was looking for. Without delving into some BBC Basic docs (which I've always meant to do), I will assume that QUIT is equivalent to END? No need to reply, unless I'm wrong. ^_^

Oh, and thanks again.
Console apps, return codes, small executables, expanded arrays, OOP (which I'm still getting my head around)... a whole litany of reasons I enjoy using your little utility.
Re: Exit or Return codes for LBB console programs?
Post by Richard Russell on Jul 15th, 2017, 08:53am

on Jul 15th, 2017, 04:00am, CirothUngol wrote:
I will assume that QUIT is equivalent to END?

It's rather more 'final', in that !QUIT immediately and unconditionally terminates the application, whereas the behavior of END depends on whether there is a NOMAINWIN statement and whether your program was compiled or run from the IDE.

Richard.