Functions

Functions in Cyclone


Syntax

Functions are defined using function keyword.

function foo(<parameters>){
    <statements>
}

Example:

function hello(){
    print("hello world")
}

Parameters

To reduce ambiguity and make programs robusts, the parameters of functions need to be explicitly typed.

Example:

function sum(a:int, b:int){
    print(string(a+b))
}

Return Type

If function returns anything, then it also needs to be explicitly typed.

Example:

function sum(a:int, b:int) : int{
    return a + b
}

    Theme

    Presets

    Background

    Custom:

    Primary

    Custom:

    Secondary

    Custom:

    Border

    Custom:

    Mode

    Light
    Dark