vipsi - the friendly vip script interpreter

Data Types

Flow control: if … then
Flow control: try … then
The
vip Example Scripts: CGI Scripts
Example Scripts: Scripts
script
language knows about 4 Data Types
Invariants: Data types
data types
:

  1. Data Types: NumbersNumbers
  2. Data Types: Text
    Item selector "[]": Text
    Glossary: text, text_val
    Text
  3. Data Types: Lists and arrays
    Item selector "[]": Lists
    Glossary: list, list_val
    Lists
    / Data Types: Lists and arraysarrays
  4. Vipsi command syntax: Procedures
    Data Types: Procedures
    Glossary: Procedure
    Procedures

Sometimes Vipsi command syntax: Identifiers (names)
Identifiers, names
Operators: Make Identifier "@"
Text functions: name
Glossary: Name, Identifier
names
itself may be considered as a 5Flow control: if … then
Flow control: try … then
th
Data Types
Invariants: Data types
data type
.

Numbers

Data Types: NumbersNumbers are stored internally in an 8-byte IEEE Number literals: Floating pointfloating point format (except Flow control: if … thenif List functions: thisthis format is Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
available) which allows for a precision of up to 53 bits including Numeric functions: signsign bit (approx. ±16 Number literals: Decimal
Integer numbers: Decimal
Floating point: Decimal
decimal
digits) Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
an exponent of 11 bits (approx. ±308 Number literals: Decimal
Integer numbers: Decimal
Floating point: Decimal
decimal
digits).

Support for 10-byte IEEE Data Types: Numbersnumbers as a compile-time option is planned (as of version 0.8.7), which will give you 64 bit accuracy.

Maximum values are:
Numeric functions: minmin./Numeric functions: maxmax. integer:        ±((1<<53)-1)
                        = ±9.007199254741e+15

Numeric functions: minmin./Numeric functions: maxmax. Glossary: Valuevalues:         ±(((1<<53)-1)<<52)<<1023
                        = ±1.7976931348623e+308

nearest Glossary: Valuevalues to null:   ±1>>1022
(full precision)        = ±2.2250738585072e-308

nearest Glossary: Valuevalues to null:   ±(1>>52)>>1022
(denormalized)          = ±4.9406564584125e-324

Besides that are some abnormal monstrosities like NaNs Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
signed zeros. I hope for your sake that you never need it. B-)

Number literals

Literals: Number literals
Numbers: Number literals
Number literals
can be written in multiple styles. All Literals: Number literals
Numbers: Number literals
number literals
can be preceded by a Glossary: number, num_valnumber Numeric functions: signsign '+' Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
'-'.

Integer numbers

Decimal

Literals: Number literals
Numbers: Number literals
Number literals
with Integer numbers: Base 256base 10:

1234
-1234
+234567
Hexadecimal

Literals: Number literals
Numbers: Number literals
Number literals
with Integer numbers: Base 256base 16 are introduced with a dollar Numeric functions: signsign '$':

$123affe
-$adf
+$adfeee
Binary

Literals: Number literals
Numbers: Number literals
Number literals
with Integer numbers: Base 256base 2 are introduced with a percent Numeric functions: signsign '%':

%10100101
%1011010010101010101010101010100101
+%10100101
-%010111
Base 256

Literals: Number literals
Numbers: Number literals
Number literal
with 'character digits'. Each character represents a digit in range [0 .. 255]. Flow control: if … thenIf you Functions with varying return types: include
Instructions: include
include
characters with a character code greater than 255 Flow control: if … then
Flow control: try … then
then
Flow control: if … then
Flow control: try … then
the
character code is silently chopped.

'a'
'bee'
+'mixa'
-'AFFE'
'2A\'s'             escaping a "'"
'\n'                other escape codes are allowed too
'\x1e'              see --> Escape characters

Floating point

Number literals: Floating pointFloating point Glossary: number, num_valnumber can be written with a Number literals: Decimal
Integer numbers: Decimal
Floating point: Decimal
decimal
, Integer numbers: Hexadecimal
Floating point: Hexadecimal
Text functions: hexstr
hexadecimal
Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Integer numbers: Binary
Floating point: Binary
Text functions: binstr
binary
number Integer numbers: Base 256base. Scientific notation (with exponent) is only supported for Number literals: Decimal
Integer numbers: Decimal
Floating point: Decimal
decimal
Data Types: Numbersnumbers.

Decimal
-123.456
0.456
123.456e78          scientific notation
+123.456e-78
.123                List functions: thisthis is Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
a Glossary: number, num_valnumber!
Hexadecimal
$0.FFFFFFFF
-$b00.b00f
+$afddb00.00d
Binary
%101000.00101
+%1010.0101
-%1010.010100

Text

Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
Text
is stored internally in a format that allows for virtually any Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
dir: lengthlength Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
can store any unicode character (Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
beyond) including character code 0. There is no problem storing Integer numbers: Binary
Floating point: Binary
Text functions: binstr
binary
daty in Data Types: Text
Text functions: string
strings
. In fact, it is common practice to Instructions: readread whole Text functions: file
Instructions: file
files
into a Data Types: Text
Text functions: string
string
before starting work on Flow control: if … then
Flow control: try … then
them
. ;-)

When reading Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
from a Text functions: file
Instructions: file
file
in Integer numbers: Binary
Floating point: Binary
Text functions: binstr
binary
mode Flow control: if … then
Flow control: try … then
the
resulting Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
consists only of characters with codes in range [0 .. 255]. You can Flow control: do … loopdo manual conversion with Text functions: convert
Instructions: convert
convert
Flow control: if … thenif required, mocrifying your Integer numbers: Binary
Floating point: Binary
Text functions: binstr
binary
data into a real Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
unicode compliant Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
. When reading a Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
in Flow control: if … then
Flow control: try … then
the
preferred way with Instructions: getget from an opened stream Flow control: if … then
Flow control: try … then
then
you Instructions: getget Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
, Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
Integer numbers: Binary
Floating point: Binary
Text functions: binstr
binary
data, Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Flow control: if … then
Flow control: try … then
the
conversion is already done for you. Flow control: if … then
Flow control: try … then
The
default encoding is UTF-8. Writing to Text functions: file
Instructions: file
files
Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
streams works similar - just reverse.

Text literals

Literals: Text literals
Text: Text literals
Text literals
are written 'as is' Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
enclosed in either of two types of Separatorsseparators:

"hello"             a simple Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
«say "hello"» a simple Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
which contains quotes "List functions: thisthis is a longish Literals: Text literals
Text: Text literals
text literal
which Functions with varying return types: include
Instructions: include
includes
two line breaks.\n" Instructions: var
How does VScript::Value() work?: Var*&
var
myText = "List functions: thisthis is a long Literals: Text literals
Text: Text literals
text literal
\ which spans multiple lines \ but which Flow control: do … loopdoes Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
Functions with varying return types: include
Instructions: include
include
Flow control: if … then
Flow control: try … then
the
line breaks \ Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
indentation characters."

Literals: Text literals
Text: Text literals
Text literals
can enclose any character, including line breaks, but except Flow control: if … then
Flow control: try … then
the
closing Separatorsseparator. Some control codes may be hard too. B-)

Escape character

Control codes Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
characters with special meaning, that is, Flow control: if … then
Flow control: try … then
the
Text literals: Escape characterescape character Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Flow control: if … then
Flow control: try … then
the
closing Separatorsseparator, Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
most other characters too can be escaped using c- Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
bash-style character escaping Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
encoding introduced with Flow control: if … then
Flow control: try … then
the
backslash '\' character:

\\      escapes Flow control: if … then
Flow control: try … then
the
Text literals: Escape characterescape character \" escapes Flow control: if … then
Flow control: try … then
the
closing Separatorsseparator in ".." Data Types: Text
Text functions: string
strings
\» escapes Flow control: if … then
Flow control: try … then
the
closing Separatorsseparator in «..» Data Types: Text
Text functions: string
strings
\123 circumscribes a character with octal notation character code range: [0 .. 255] \x1a circumscribes a character with Integer numbers: Hexadecimal
Floating point: Hexadecimal
Text functions: hexstr
hexadecimal
notation character code range: [0 .. 255] \cX circumscribes a control character by applying a bit mask character code range: [0 .. 31] \n circumscribes a character with it's 'well known Vipsi command syntax: Identifiers (names)
Identifiers, names
Operators: Make Identifier "@"
Text functions: name
Glossary: Name, Identifier
name
' List functions: thisthis is Flow control: if … then
Flow control: try … then
the
Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
: \e \a \b \f \n \r \t \v $1B $07 $08 $0C $0A $0D $09 $0B \ Operators: Make Identifier "@"at Flow control: end
Shell Immediate Commands: exit, quit, end
end
of line: discards Flow control: if … then
Flow control: try … then
the
line break Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
all white space up to Flow control: if … then
Flow control: try … then
the
first printable character. Used to break up Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
in Literals: Text literals
Text: Text literals
text literals
for readability.

A "\" backslash before any other character without special meaning is simply discarded.

Short survey on substrings

Individual characters Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
substrings are accessed with either Text functions: leftstrleftstr() Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Flow control: if … then
Flow control: try … then
the
like Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
an array-like notation:

Instructions: putput "Anton"[3]                 // prints: t
Instructions: putput "Anton Bruckner"[3 to 5]   // prints: ton
Instructions: putput "Caesar Cicero"[to 5]      // prints: Caesar
Instructions: putput "Caesar Cicero"[8 to]      // prints: Cicero
Instructions: putput "Casiopeia"[ to ]          // prints: Casiopeia

Numeric functions: indexIndexes start Operators: Make Identifier "@"at 1, ranges are declared with Flow control: if … then
Flow control: try … then
the
first Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
last Numeric functions: indexindex inclusive.

Lists and arrays

Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
Lists
may be of any size Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
nested to any level Flow control: untiluntil you run out of RAM.

List literals

Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
Lists
can be initialized with { ... } in one go, including nested sub-lists Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
naming of Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
items.

{ }                   an empty Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
{ 1, 2, 3 } a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
with three items { "a", "b", 44 } again three items { 1, {"a","b"} } two items. Flow control: if … then
Flow control: try … then
the
second item itself is a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
{ x=22, y=1.5, z=0 } items may by named
Printing list literals in the vipsi shell

Separators: Curly brackets "{ … }"
Instructions: Local scope "{}"
Braces
{ ... } are used to enclose ranges of program code with a private Glossary: Variable, var_refvariable scope Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
for Literals: List literals
Lists and arrays: List literals
list literals
. List functions: thisThis depends on Flow control: if … then
Flow control: try … then
the
place where they are encountered. Flow control: if … thenIf a Separators: Curly brackets "{ … }"
Instructions: Local scope "{}"
brace
occurs Operators: Make Identifier "@"at Flow control: if … then
Flow control: try … then
the
place of an Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
instruction
Flow control: if … then
Flow control: try … then
then
it starts a private Glossary: Variable, var_refvariable scope. Flow control: if … thenIf a Separators: Curly brackets "{ … }"
Instructions: Local scope "{}"
brace
occurs Operators: Make Identifier "@"at Flow control: if … then
Flow control: try … then
the
position of an Vipsi command syntax: Expressions
Glossary: Expression
expression
Flow control: if … then
Flow control: try … then
then
it is Flow control: if … then
Flow control: try … then
the
beginning of a Literals: List literals
Lists and arrays: List literals
list literal
.

Flow control: if … then
Flow control: try … then
The
only place where List functions: thisthis may lead to confusion is Flow control: if … then
Flow control: try … then
the
vipsi shell: Operators: Make Identifier "@"At Flow control: if … then
Flow control: try … then
the
start of Flow control: if … then
Flow control: try … then
the
command line Flow control: if … then
Flow control: try … then
the
parser expects an Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
instruction
. For your convenience it is also possible to just type an Vipsi command syntax: Expressions
Glossary: Expression
expression
Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Flow control: if … then
Flow control: try … then
the
shell will print Flow control: if … then
Flow control: try … then
the
result. Thus Flow control: if … thenif you just type in

{ x=22, y=1.5, z=0 }

to see whether vipsi evaluates your Literals: List literals
Lists and arrays: List literals
list literal
as expected, Flow control: if … then
Flow control: try … then
then
Flow control: if … then
Flow control: try … then
the
opening { stands Operators: Make Identifier "@"at Flow control: if … then
Flow control: try … then
the
position of an Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
instruction
Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
should be handled as Flow control: if … then
Flow control: try … then
the
start of a range of Vipsi command syntax: Statements
Glossary: Statement
statements
with private Glossary: Variable, var_refvariable scope.

As of version 0.8.8 Flow control: if … then
Flow control: try … then
the
shell has some automagic intelligence to detect List functions: thisthis. Flow control: if … thenIf a command line starts with an opening Separators: Curly brackets "{ … }"
Instructions: Local scope "{}"
brace
{ Flow control: if … then
Flow control: try … then
then
Flow control: if … then
Flow control: try … then
the
shell defaults to a Literals: List literals
Lists and arrays: List literals
list literal
, except Flow control: if … thenif it contains a Separators: Semicolon ";"semicolon ";" Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
a pure Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
instruction
like Instructions: var
How does VScript::Value() work?: Var*&
var
. List functions: thisThis is done by silently putting a Instructions: putput Vipsi command syntax: Statements
Glossary: Statement
statement
in front of Flow control: if … then
Flow control: try … then
the
Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Flow control: if … then
Flow control: try … then
the
printed result is Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
not
always identical to what would be printed Flow control: if … thenif it would have been evaluated as an Vipsi command syntax: Expressions
Glossary: Expression
expression
without glue.

Short survey on sublists and access to single items

Individual items Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
substrings are accessed either by Vipsi command syntax: Identifiers (names)
Identifiers, names
Operators: Make Identifier "@"
Text functions: name
Glossary: Name, Identifier
name
Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
with an array-like notation:

Numeric functions: indexIndexes start Operators: Make Identifier "@"at 1, ranges are declared with Flow control: if … then
Flow control: try … then
the
first Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
last Numeric functions: indexindex inclusive.

Accessing an item beyond Flow control: if … then
Flow control: try … then
the
Flow control: end
Shell Immediate Commands: exit, quit, end
end
of a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
automatically creates all intermediate items, which are unnamed Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
set to Glossary: number, num_valnumber Glossary: Valuevalue 0.0.

Instructions: var
How does VScript::Value() work?: Var*&
var
my_list = { 1, 2, 3, a=4, b=5, c=6 } Instructions: putput my_list.a // prints: 4 Instructions: putput my_list[3] // prints: 3 Instructions: putput my_list[3 to 5] // prints: { 3, a=4, b=5 } Instructions: putput my_list[to 4] // prints: { 1, 2, 3, a=4 } Instructions: putput my_list[5 to] // prints: { b=5, c=6 } Instructions: putput my_list[ to ] // prints: { 1, 2, 3, a=4, b=5, c=6 }
Instructions: var
How does VScript::Value() work?: Var*&
var
list2 = { 1, z={ 2, z="Anton", 3}, 4 } Instructions: putput list2.z // prints: { 2, z="Anton", 3 } Instructions: putput list2.z.z // prints: Anton Instructions: putput list2[2,2,to 3] // prints: Ant Instructions: putput list2.z[2,to 3] // prints: Ant
Instructions: var
How does VScript::Value() work?: Var*&
var
list3={} // create empty Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
list3[100] // resize Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
to 100 elements
Instructions: var
How does VScript::Value() work?: Var*&
var
i = Numeric functions: intint(Numeric functions: randomrandom(2)) +1 Instructions: putput { "foo", "bär" }[i]

Procedures

Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
Procedures
are a Data Types
Invariants: Data types
data type
. Once defined, they can be executed, disassembled, passed to other Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedures
as Vipsi command syntax: Arguments
Glossary: Arguments
argument
Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
Instructions: putput into a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
.

Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
Procedures
can be called recursively.

Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
Procedures
in a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
can access 'neighbour' data elements by Vipsi command syntax: Identifiers (names)
Identifiers, names
Operators: Make Identifier "@"
Text functions: name
Glossary: Name, Identifier
name
, thus supplying a light-weight approach for object oriented programming.

Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
Procedures
can either take a fixed Glossary: number, num_valnumber of Vipsi command syntax: Arguments
Glossary: Arguments
arguments
Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
a Glossary: Variable, var_refvariable amount, indicated with an asterics *.

They can Flow control: returnreturn a result of any Data Types
Invariants: Data types
data type
(Glossary: number, num_valnumber, Data Types: Text
Item selector "[]": Text
Glossary: text, text_val
text
, Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
a Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
) Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
no result. Flow control: if … then
Flow control: try … then
The
result they Flow control: returnreturn may vary depending on Flow control: if … then
Flow control: try … then
the
Vipsi command syntax: Arguments
Glossary: Arguments
argument
data Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
other criteria.

Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
Procedures
may be defined locally inside other Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedures
. Because they can access 'neighbour' data items, they can access Flow control: if … then
Flow control: try … then
the
List functions: localslocal data of Flow control: if … then
Flow control: try … then
the
enclosing Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
.

Procedure literals

Literals: Procedure literals
Procedures: Procedure literals
Procedure literals
start with Flow control: if … then
Flow control: try … then
the
keyword Instructions: procproc, followed by Separators: Round brackets "( … )"
Functions with varying return types: bracket expression "()"
parenthesis
surrounding Flow control: if … then
Flow control: try … then
the
Vipsi command syntax: Arguments
Glossary: Arguments
arguments
Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Separators: Curly brackets "{ … }"
Instructions: Local scope "{}"
braces
surrounding Flow control: if … then
Flow control: try … then
the
Vipsi command syntax: Statements
Glossary: Statement
statements
to execute.

<procedure> = Instructions: procproc ( <arguments> ) { <statements> }

Flow control: if … then
Flow control: try … then
The
more common way to define a Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
is with Flow control: if … then
Flow control: try … then
the
Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
instruction
Instructions: procproc.

Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
Instruction
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
stores Flow control: if … then
Flow control: try … then
the
Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
in one go. Flow control: if … then
Flow control: try … then
The
Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
itself is written in a form very similar to that of a Literals: Procedure literals
Procedures: Procedure literals
procedure literal
. Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
Instruction
Instructions: procproc is a short form for creating a Glossary: Variable, var_refvariable as with Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
instruction
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 literals
procedure literal
as initial Glossary: Valuevalue. Operators: Bitwise Not "~"
Operators: Boolean Negation "!"
Note
Flow control: if … then
Flow control: try … then
the
difference:

Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
Instruction
Instructions: procproc:

Instructions: procproc <name> ( <arguments> ) { <statements> }

Vipsi command syntax: Instructions
Instructions
Glossary: Instruction
Instruction
Instructions: var
How does VScript::Value() work?: Var*&
var
with Literals: Procedure literals
Procedures: Procedure literals
procedure literal
as initial Glossary: Valuevalue:

Instructions: var
How does VScript::Value() work?: Var*&
var
<name> = Instructions: procproc ( <arguments> ) { <statements> }

Using a real Literals: Procedure literals
Procedures: Procedure literals
procedure literal
is sometimes convenient Flow control: if … thenif you want to Instructions: putput it in a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
Operators: Boolean Or with Variable "||="
Operators: Bitwise Or with Variable "|="
Operators: Bitwise Or "|"
Operators: Boolean Or "||"
or
Flow control: if … thenif you want to pass it to another Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
as an Vipsi command syntax: Arguments
Glossary: Arguments
argument
.

When you Text functions: convert
Instructions: convert
convert
a Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
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_val
list
containing a Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
to a Data Types: Text
Text functions: string
string
, which is implicitely done when you print it using Instructions: putput, it is reverted to it's Vipsi command syntax: Literals
Glossary: Literal
literal
appearance.

Store Literals: Procedure literals
Procedures: Procedure literals
procedure literal
in a Glossary: Variable, var_refvariable:

Instructions: var
How does VScript::Value() work?: Var*&
var
foo = Instructions: procproc(bär) { Flow control: returnreturn bär } Instructions: var
How does VScript::Value() work?: Var*&
var
z = Instructions: procproc() { Instructions: putput "hi" }

Store Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
somewhere into a Data Types: Lists and arrays
Item selector "[]": Lists
Glossary: list, list_val
list
:

Instructions: var
How does VScript::Value() work?: Var*&
var
mylist = {} mylist[100] = Instructions: procproc() { Instructions: putput "foobär" } Instructions: putput mylist[100] // print item 100. prints disassembly mylist[100]() // execute Flow control: if … then
Flow control: try … then
the
Instructions: procproc. prints foobär

A Literals: Procedure literals
Procedures: Procedure literals
procedure literal
as part of a Literals: List literals
Lists and arrays: List literals
list literal
:

Instructions: var
How does VScript::Value() work?: Var*&
var
mylist = { 22, 33, z=Instructions: procproc(){Flow control: returnreturn List functions: thisthis[1]+List functions: thisthis[2]} } Instructions: putput mylist.z // prints Flow control: if … then
Flow control: try … then
the
Instructions: procproc: disassembly Instructions: putput mylist.z() // prints Shell Scripts: Return values
Appendix: Return values
return value
of Instructions: procproc: 55

A Literals: Procedure literals
Procedures: Procedure literals
procedure literal
as Vipsi command syntax: Arguments
Glossary: Arguments
argument
to another Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
:

SetMyFooIterator ( Instructions: procproc(i){Flow control: returnreturn i+1} );

But in most cases you would first define a Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedure
Operators: Boolean And with Variable "&&="
Operators: Bitwise And with Variable "&="
Operators: Bitwise And "&"
Operators: Boolean And "&&"
and
Flow control: if … then
Flow control: try … then
then
pass List functions: thisthis Glossary: Variable, var_refvariable as an Vipsi command syntax: Arguments
Glossary: Arguments
argument
, because Vipsi command syntax: Procedures
Data Types: Procedures
Glossary: Procedure
procedures
tend to be a little bit longish. ;-)

Valid HTML   Valid CSS