reCT

The only ByteSpace Project big enough to have its
own Website

Functions

Functions are a way to block off code and re-use it.

Functions can have Parameters and can also return objects.



Declaring a Function could look like this:

function someFunc() { ... }

To add Parameters, you can just put them inside the parentheses and specify a Datatype:

function someFunc(someParam string, someOtherParam int) { ... }

To specify a return Type, just add a Datatype after the parentheses:

function someFunc() string { ... }

Since ReCT v2.2 the Type-Arrow (->) is no longer required but is still accepted meaning both these ways are valid:

function newWay(someParam string) int { ... } function oldWay(someParam -> string) -> int { ... }

Calling a Function

Calling a Function is pretty easy.

Just write the Function's name and some parentheses after it, and if you have Parameters set you will have to put them in there.

someFunc()
someFuncWithParams("this is an parameter", 123)

Static Functions

When the Class the Function is in is static, the Function will automatically be static as well.