BEGIN action


Declaration
 BEGIN

Description
The action explicitly introduces the initialization part of the script.
Note
Implicit introduction of the initialization part of script represents any action except:
  • Begin and end of a procedure.
  • Local variable declaration.
  • Other arbitrary action within the frame of a procedure.

Further info: see Script structure.


Examples
Initialization part stated explicitly – at the end of script
 
 ;declaration of local variable
 INT _i
 ;declaration of procedure
 PROCEDURE Procedura
  _i := _i + 1
 END Procedura
 ;initialization part - stated explicitly
 BEGIN
  DELAY _i[s]
  CALL Procedura
  MESSAGE %IToStr(_i) ON srvskol1v.hip 
 END 

 
Initialization part stated implicitly – at the end of script
 
 ;declaration of local variable
 INT _i
 ;declaration of procedure
 PROCEDURE Procedura
  _i := _i + 1
 END Procedura
 ;initialization part - implicitly stated by an action which is neither a declaration 
 ;of variable, procedure nor its part
 DELAY _i[s]
 CALL Procedura
 MESSAGE %IToStr(_i) ON srvskol1v.hip
 ;end of script = end of initialization part
 

 
Initialization part stated explicitly – in front of procedure declaration
 
 ;declaration of local variable
 INT _i
 ;initialization part - explicitly stated
 BEGIN
  DELAY _i[s]
  CALL Procedura
  MESSAGE %IToStr(_i) ON srvskol1v.hip 
 END
 ;declaration of procedure after initialization part
 ;it is evaluated as an attempt to the declaration of nested procedure
 ;it ends with error when compiling
 PROCEDURE Procedura
  _i := _i + 1
 END Procedura 

 
Initialization part stated implicitly – in front of procedure declaration
 
 ;declaration of local variable
 INT _i
 ;initialization part - implicitly stated by an action which is neither a declaration 
 ;of variable, procedure nor its part
 DELAY _i[s]
 CALL Procedura
 MESSAGE %IToStr(_i) ON srvskol1v.hip
 ;declaration of procedure - it ends with error because it is within 
 ;initialization part (nested declaration)
 PROCEDURE Procedura
  _i := _i + 1
 END Procedura
 ;end of script = end of initialization part 

 
Nested initialization part
 
 ;initialization part - explicitly stated
  BEGIN
  INT _a
  _a := _a + 1
  _b := _b + 1
 ;nested initialization part - it is not allowed
  BEGIN
   INT _b
   _b := 8
   _a := _a + _b
  END
 MESSAGE "_a = " + %IToStr(_a) ON srvskol1v.hip
 MESSAGE "_b = " + %IToStr(_b) ON srvskol1v.hip
 END 


Related pages:

0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .