-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Integer (data type)
Christoph Heine edited this page Mar 29, 2018
·
4 revisions
Integers are one of the primitive data types supported by nyan. They can be positive, negative or infinite (noted as inf
).
positive_number : int = 1
negative_number : int = -5
infinite : int = inf
Unit():
hp : int
Archer(Unit):
hp = 45
The integer hp
has a value of 45
.
Unit():
hp : int = 10
Archer(Unit):
hp = 40
Overwrites the old value with a new one.
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.