• Kipper

    v0.12.1
  • Downloads

  • Docs

  • Playground

  • Changelog

  • Kipper

    v0.12.1
    • Downloads

    • Docs

    • Playground

    • Changelog

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

    • Quickstart

    • Goals for Kipper

    • Supported platforms

    • Usage Examples

      • Overview

    • Variables

      • Overview

      • String Type

      • Number Type

      • Boolean Type

      • Void Type

      • Null Type

      • Undefined Type

      • Array Type

      • Overview

      • Tangled Expression

      • Arithmetic Expression

      • Assignment Expression

      • Conditional Expressions

      • Logical Expressions

      • Bitwise Expression

      • Relational Expressions

      • Convert Or Cast Expression

      • F-String Expression

      • Member Access Expression

      • Function Call Expression

      • Lambda Expression

      • Matches Expression

      • Overview

      • Expression Statement

      • If Statement

      • While Loop

      • Do-While Loop

      • For Loop

      • Compound Statement

      • Jump Statement

    • Functions

    • Interfaces

    • Classes

    • Comments

    • Built-in Functions

      • Overview

      • Compiler Setup

        • Overview

          • index

          • compiler

          • errors

          • logger

          • utils

          • config

          • index

          • index

        • Overview

        • new

        • run

        • compile

        • help

        • version

      • next /
      • Expressions /
      • Arithmetic Expression
    • next /
    • Expressions /
    • Arithmetic Expression

    Edit page

    Arithmetic Expression

    Arithmetic expressions are simple mathematical calculations, where a numeric result is returned after the expression was evaluated. They may also be chained based on their order of precedence, where each item is one by one evaluated.

    Besides arithmetic expression there are also operator modified assignment, which can be used similarly by directly assigning the result to a variable.

    Syntax

    EXP ( + | - | * | / | ** | % ) EXP

    Examples

    Addition Operator

    400.3 + 26.3; // -> 426.6

    Minus Operator

    87 - 2.5; // -> 84.5

    Multiply Operator

    Standard multiplications can be done between operands of the type num.

    2.4 * 5; // -> 12

    Additionally, string repetitions can be also performed using the * operator.

    "Hello " * 3; // -> "Hello Hello Hello "

    Divide Operator

    25 / 4; // -> 6.25

    Power-To Operator

    2 ** 8; // -> 256

    Modulo Operator

    51 % 10; // -> 1
  • 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.