Instructions: procproc <name> ( <arguments> ) { <statements> }
Create a Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure.
Flow control: if … then Flow control: try … thenThe Vipsi command syntax: Instructions Instructions Glossary: Instructioninstruction Instructions: procproc creates a Glossary: Variable, var_refvariable Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Operators: Assignment "="assigns it a Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure as it's Glossary: Valuevalue. Flow control: if … then Flow control: try … thenThe Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure itself is written in a form very similar to that of a Literals: Procedure literals Procedures: Procedure literalsprocedure literal.
<arguments> denotes a Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist of Vipsi command syntax: Arguments Glossary: Argumentsargument Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiernames. It may be empty, consist of one Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiername, Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or a Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist of Vipsi command syntax: Identifiers (names) Identifiers, names Operators: Make Identifier "@" Text functions: name Glossary: Name, Identifiernames separated by Separators: Comma ","commas. Flow control: if … then Flow control: try … thenThe last item in Flow control: if … then Flow control: try … thenthe Vipsi command syntax: Arguments Glossary: Argumentsarguments Data Types: Lists and arrays Item selector "[]": Lists Glossary: list, list_vallist may be Flow control: if … then Flow control: try … thenthe special character *, which indicates that an unknown amount of further Vipsi command syntax: Arguments Glossary: Argumentsarguments may be passed to Flow control: if … then Flow control: try … thenthe Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure. These are stored in unnamed List functions: localslocal Glossary: Variable, var_refvariables, which can be accessed using List functions: localslocals[<index>].
<statements> are Flow control: if … then Flow control: try … thenthe Vipsi command syntax: Statements Glossary: Statementstatements which are executed when Flow control: if … then Flow control: try … thenthe Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure is called.
Actually Vipsi command syntax: Instructions Instructions Glossary: Instructioninstruction Instructions: procproc is a short form for creating a Glossary: Variable, var_refvariable with Vipsi command syntax: Instructions Instructions Glossary: Instructioninstruction Instructions: var How does VScript::Value() work?: Var*&var Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and assigning it a Literals: Procedure literals Procedures: Procedure literalsprocedure literal as initial Glossary: Valuevalue. Operators: Bitwise Not "~" Operators: Boolean Negation "!"Note Flow control: if … then Flow control: try … thenthe difference:
Vipsi command syntax: Instructions Instructions Glossary: InstructionInstruction Instructions: procproc:
Instructions: procproc <name> ( <arguments> ) { <statements> }
Vipsi command syntax: Instructions Instructions Glossary: InstructionInstruction Instructions: var How does VScript::Value() work?: Var*&var with Literals: Procedure literals Procedures: Procedure literalsprocedure literal as initial Glossary: Valuevalue:
Instructions: var How does VScript::Value() work?: Var*&var <name> = Instructions: procproc ( <arguments> ) { <statements> }
e.g.:
Instructions: procproc foo(bär) { Flow control: returnreturn bär }
Instructions: var How does VScript::Value() work?: Var*&var foo = Instructions: procproc(bär) { Flow control: returnreturn bär }
See --> Literals: Procedure literals Procedures: Procedure literalsProcedure literals for more details on Literals: Procedure literals Procedures: Procedure literalsprocedure literals. (sic!)
Examples
Instructions: procproc foo() { }
Instructions: procproc bee(a) { Instructions: putput a }
Instructions: procproc x(a,b) { Flow control: returnreturn a+b }
Instructions: procproc foo.bar() { }
Instructions: procproc fak(n) { Flow control: if … thenif n<=1 Flow control: returnreturn 1; Flow control: if … then Flow control: try … thenelse Flow control: returnreturn n*fak(n-1); Flow control: if … then Flow control: try … thenthen }
Instructions: putput fak(77)
Instructions: procproc foo(a) { Instructions: putput a } // define Vipsi command syntax: Procedures Data Types: Procedures Glossary: Procedureprocedure foo
foo(123) // Functions with varying return types: call Instructions: callcall foo; prints Flow control: if … then Flow control: try … thenthe Glossary: number, num_valnumber: 123
foo("abc") // Functions with varying return types: call Instructions: callcall foo; prints Flow control: if … then Flow control: try … thenthe Data Types: Text Item selector "[]": Text Glossary: text, text_valtext: abc
Instructions: putput foo // Instructions: putput prints foo: disassembly
Instructions: procproc Operators: Add to Variable "+=" Operators: Add "+"add ( * )
{
Instructions: var How does VScript::Value() work?: Var*&var i = Numeric functions: countcount(List functions: localslocals)
// Operators: Bitwise Not "~" Operators: Boolean Negation "!"note: Numeric functions: countcount(List functions: localslocals) Functions with varying return types: include Instructions: includeincludes +1 for Instructions: var How does VScript::Value() work?: Var*&var i itself!
Instructions: var How does VScript::Value() work?: Var*&var result = 0
Flow control: do … loopdo
Flow control: whilewhile --i
result += List functions: localslocals[i]
Flow control: do … looploop
Flow control: returnreturn result
}
|