function

beasscript-logo-small

function <funktionsname>

 

Important without "=" and without parameter

this is a local function and is only visible in this script. To define functions which are visible in the window, use "global function"

If you exit the function with "return failure", the return-value = -1, "return success" = 1 other = 0

 

NOTE: work with lower case only!

 

Syntax:

function myfunc

... Script

end

 

Call:

myfunc()

 

 

This can only be used inside of Scripts.

 

Example:

// example

displaymessage()

return

 

function displaymessage

messagebox=This is my sub-function

end function

 

 

NOTE:

Functions can also be called inside the first parameter of an "if" statement.

Return value can be -1 or 1

Example:

if=colorquestion()=-1=cancel

messagebox=info$your color is red

return success

 

function colorquestion

question=Another Color as red?=success=failure

end function