Int
An integer value, e.g. 12
.
var integer = 12
Methods
clamped(min: Int, max: Int) -> (Int)
Returns a value that restricts the given value within the given min
and max
range.
var a = 30
var b = a.clamped(min: 0, max: 10)
print ("\{b}") // Prints 10
to_float() -> (Float)
Returns the float representation of the given integer number.
var i = 5
var f = i.to_float()
print("\{f}") //print 5.0