• Kipper

    v0.12.1
  • Downloads

  • Docs

  • Playground

  • Changelog

  • Kipper

    v0.12.1
    • Downloads

    • Docs

    • Playground

    • Changelog

      • 0.10.4 /
      • Datatypes /
      • Void Type
    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 /
      • Datatypes /
      • Void Type
    • 0.10.4 /
    • Datatypes /
    • Void Type

    Edit page

    Void Type - void

    The void type represents a value that is nothing and may only be void or undefined.

    This is usually used for functions to hint they have no return. Otherwise, this data type is practically useless, as it is practically only a synonym for undefined.

    The only difference is that void is indicating that the value is always nothing, while undefined is indicating that the value is nothing at the moment but may be something later (Like in an optional parameter or a variable that is not yet assigned).

    This also means comparing void to undefined will always be true:

    var var1: void = void;
    var var2: undefined = undefined;
    
    var1 == var2; // true

    Note that unlike in JavaScript, void is not an operator, but a type. This means that standard syntax of void 0 is not valid in this language. Instead, simply use void.

    Note

    This may change in the future, as a way to allow the easy nullification of data using the void EXP syntax.

    Examples

    Creating a void variable

    var var1: void = void;

    Using void to indicate a function has no return

    def func1() -> void {
      return;
    }

    Explicitly returning void for a function

    def func2() -> void {
      return void;
    }

    Assigning void value to a void variable

    var var23: void = func2();

    X Can not assign to a void variable anything but void

    // X May not set a 'void' variable to anything except 'void'
    var var2: void = 4;
  • 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.