start

Prev Next

Function Names

start

Synopsis

start ( program file name, parameters )

Description

Starts a separate B4P application script as a sub program and waits until the sub program has ended.

  • Global variables defined (with global() function) will be preserved.
  • The code will not stay resident in memory after completion. When called again with start (...), the program will be reloaded.
  • User procedures and functions defined in the called program will be deleted when execution of the program has ended.
  • Local variables created inside the program will be discarded when execution has ended
  • Since the code is removed after completion, memorized once() calls will also get lost. Next time the file will be loaded, once() {} behaves as if the code is being run for the first time and the subsequent code is executed.
  • If a program previously called with include() and is now called with start(), then the resident code is made non-resident again and will be removed when done.

Call as: procedure or function

Restrictions

When using start function from command line, then encapsulate this function in braces in order to avoid confusion with the interactive start command.

Parameter count

Min. 1

Parameters

No.TypeDescription
1
input
string Program Name

Name of B4P program to start. Do not forget to specify the suffix, e.g. '.b4p' or '.txt'.

Opt. 2, etc.
input
all types Additional parameters

Any additional optional parameter. If specified, then they will replace the existing "command line parameters" by the ones supplied here.

Return value

TypeDescription
all types returned value

Value returned by called program

Exceptions

Program file not found

Examples

      start( "start.txt", 123, abc, true, date(24.12.2015),{});
      // The parameters will be passed in their given typs to 'command line arguments.
      // command line argument[0]: start.txt   (The file name of the program)
      // command line argument[1]: 123 (numeral)
      // command line argument[2]: abc (string)
      // command line argument[3]: true (boolean)
      // command line argument[4]: 2015-12-24 (date)
      // command line argument[5]: {} (empty parameter set)
      //
      // How to start this program in interactive mode:
      { start( "start.txt", 123, abc, true, date(24.12.2015),{}); }

See also

include