• Kipper

    v0.12.1
  • Downloads

  • Docs

  • Playground

  • Changelog

  • Kipper

    v0.12.1
    • Downloads

    • Docs

    • Playground

    • Changelog

      • 0.10.4 /
      • Expressions /
      • Function Call Expression
    Kipper Docs
    • next
    • latest
    • 0.11.0
    • 0.10.4
    • 0.9.2
    • Overview

    • Quickstart

    • Goals for Kipper

    • Supported platforms

    • Usage Examples

      • Overview

      • Compiler Setup

    • Variables

      • Overview

      • String Type

      • Number Type

      • Boolean Type

      • Void Type

      • Null Type

      • Undefined Type

      • Array Type

      • Overview

      • Arithmetic Expression

      • Assignment Expression

      • Conditional Expressions

      • Logical Expressions

      • Relational Expressions

      • Convert Or Cast Expression

      • Function Call Expression

      • Overview

      • Expression Statement

      • If Statement

      • While Loop

      • Do-While Loop

      • For Loop

      • Compound Statement

      • Jump Statement

    • Functions

    • Comments

    • Built-in Functions

      • 0.10.4 /
      • Expressions /
      • Function Call Expression
    • 0.10.4 /
    • Expressions /
    • Function Call Expression

    Edit page

    Function Call Expression

    Function call expression are expressions that call and run a specified function and evaluates to the return of the function. In case the return value is not assigned to any variable or used in another expression, then it will be simply discarded.

    If the return type of the function is void, then the function call expression will not return any value.

    See also Functions.

    Syntax

    call NAME(ARG1, ARG2, ARGn, ...);
    // OR - 'call' is optional
    NAME(ARGS, ARG2, ARGn, ...);

    Examples

    Calling a defined function

    def func1(val1: num, val2: num) -> num {
        return val1 + val2;
    }
    func1(10, 10); // -> 20

    Calling a defined function and assigning it

    def func2(val1: num, val2: num) -> num {
        return val1 * val2;
    }
    var example1: num = func2(10, 10); // -> 100

    Multiple chained function calls

    def func3(val1: num, val2: num) -> num {
        if (val1 < 0) {
            return 0;
        }
        return val1 * val2;
    }
    var example2: num = func3(5, 10) + func3(-1, 10); // -> 50

    Using the return of a function with a return type of void

    def func4() -> void {
        return;
    }
    var example3: void = func4(); // -> void

    X Can not use the return of a void function

    def func4() -> void {
        return;
    }
    4 + func5(); // -> Error: Invalid arithmetic operation between types 'num' and 'void'.
  • Developed at:

    • Releases
    • GitHub
    • Security
    • Issue Tracker
    • License
  • Copyright © 2021-2025 Luna Klatzer, 2024-2025 Lorenz Holzbauer & Fabian Baitura.
    Kipper is licensed under the GPL-3.0-or-later license.