-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Integer (data type)
Christoph Heine edited this page Mar 20, 2018
·
4 revisions
Integers are one of the primitive data types supported by nyan. They can be positive, negative or infinite (noted as inf
).
(Abstract)
positive_number : int
negative_number : int
infinite : int
(Initialization)
positive_number = 1
negative_number = -5
infinite = inf
Unit():
hp : int
Archer(Unit):
hp = 45
The integer hp
has a value of 45
.
Archer(Unit):
hp = 45
BetterArcher<Archer>():
hp += 10
Adds a given value to the integer.
Archer(Unit):
hp = 45
WorseArcher<Archer>():
hp -= 10
Subtracts a given value from the integer.
Archer(Unit):
hp = 45
SuperArcher<Archer>():
hp *= 1.8
Multiplies an integer by another integer or a float.
Archer(Unit):
hp = 45
WeakArcher<Archer>():
hp /= 1.2
Divides an integer by another non-zero integer or non-zero float.