anScript

Instructions

Remember that name is not variable! It’s name of instruction (but it actually could be variable - read anScript advanced). Calling instructions is quite simple (e.g. firstInstruction(a), secondInstruction(b, c)). You can pass arguments to your own instructions by reference or value (see examples).


instructionCreate(name) or instructionCreate(name, var arg, ...)

semi-tag, to make non-direct call add { at the and of line

Create instruction named name from code of block that ends on line with closing curly brace (}).


instructionCreateLines(name, var.i howManyLines) or instructionCreateLines(name, var.i howManyLines, var arg, ...)

not recommended for beginner

Create instruction named name from code of block that consists of howManyLines lines, howManyLines includes line with instructionCreateLines instruction and doesn’t include empty lines or lines with comments.


instructionCreateIdentifier(name, var idn) or instructionCreateIdentifier(name, var idn, var arg, ...)

not recommended for beginner

Create instruction named name from code of block that ends on line with identifier (identifier(var idn)).


instructionExecute(name) or instructionExecute(name, var arg, ...)

Execute instruction named name. Number of parameters must match number of parameters when instruction was created (or could be variable for instructions with variable number of arguments). If instruction named name wasn’t found, check whether value of variable named name is name of instruction (if it is, execute it).

More about instructionExecute: anScript advanced


name() or name(var arg, ...)

Execute instruction named name (simpler syntax than instructionExecute).


instructionExecuteInNewThread(name) or instructionExecuteInNewThread(name, var arg, ...)

actual implementation could be described rather as asynchronous

Execute instruction named name in new thread.


instructionCAR()

Perform one iteration of CAR (code at runtime).

Examples

Passing arguments by reference:

instructionCreate(ins,a)
    variableAssign(a,3.14.f)
}
variableCreate(b,70.i)
/Now b has value 70.i
ins(b)
/Now b has value 3.14

Passing arguments by value:

instructionCreate(ins,a)
    variableAssign(a,3.14.f)
}
variableCreate(b,70.i)
/Now b has value 70.i
ins(*b)
/Now b has value 70.i