//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010, 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available
// under the terms of the MIT License which is available at
// https://opensource.org/licenses/MIT
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

include::../_part_attributes.asciidoc[]

:leveloffset: -2

[[lang-tut-values-chapter-integers]]
== Integers

indexterm:[integer]
indexterm:[type,integer]
indexterm:[integer,type]
indexterm:[value,integer]
indexterm:[integer,value]
indexterm:[literal,integer]
indexterm:[integer,literal]
Integers are whole numbers, numbers without a fractional part.
Examples include `-123` and `5`.
The default value of integers (`int` type) is `0`.
Several standard arithmetic operators and functions are available to work with integers, including the following:

[source, cif]
----
+9          // 9
--9         // 9

9 + 4       // 13
9 - 4       // 5
9 * 4       // 36
9 / 4       // 2.25 (result is a real number, not an integer number)

9 div 4     // 2    (9 / 4 = 2.25, so 4 fits at most two whole times in 9)
9 mod 4     // 1    (the remainder of 9 div 4)

pow(2, 4)   // 16   (2 to the power of 4, or 2 * 2 * 2 * 2)
abs(-9)     // 9    (absolute value)
min(9, 4)   // 4    (minimum value)
max(9, 4)   // 9    (maximum value)
----

Integer values can be compared to other integer values:

[source, cif]
----
x < y       // less than
x <= y      // less than or equal to
x = y       // equal to
x != y      // not equal to
x >= y      // larger than or equal to
x > y       // larger than
----

The next lesson explains how to define <<lang-tut-values-chapter-ranged-integers,ranged integers>>.

// TODO: link to future ref manual
