
Short data type is type of data that represents integer number and can be created using Integer Literal.
Check out short cheat sheet containing code samples for working with short data type.
Short
var value: Short = 65 //Create short data using integer literal which is implicitly converted to short data.
Int data type is type of data that represents integer number and can be created using Integer Literal.
Check out int cheat sheet containing code samples for working with int data type.
Int
//CREATE INTEGER DATA USING INTEGER LITERAL IN DIFFERENT NOTATIONS.
var value : Int = 65 //Decimal.
value = 0x41 //Hexadecimal. 0X41
value = 0b1000001 //Binary. 0B1000001
value = 10_000 //You can use underscore any way you like: 10_000, 0b10__00_001
Long data type is type of data that represents integer number and can be created using Long Literal.
Check out long cheat sheet containing code samples for working with long data type.
Long
//CREATE LONG DATA USING INTEGER LITERAL IN DIFFERENT NOTATIONS.
var longValue = 1000L //Use "L" sufix to specify Long value when Data Type is not declared
var value : Long = 65 //Decimal.
value = 0x41 //Hexadecimal. 0X41
value = 0b1000001 //Binary. 0B1000001
value = 10_000 //You can use underscore any way you like: 10_000, 0b10__00_001
Float Data Type is type of data that represents real number and can be created using Float Literal.
Check out float cheat sheet containing code samples for working with float data type.
Float
//CREATE FLOAT DATA USING FLOAT LITERAL IN DIFFERENT NOTATIONS.
var value : Float = 65.23f //Basic notation. 65F
value = 0.6523E2f //Scientific notation. 0.6523E2 F
Double data type is type of data that represents real number and can be created using Double Literal.
Check out double cheat sheet containing code samples for working with double data type.
Double
//CREATE DOUBLE DATA USING DOUBLE LITERAL IN DIFFERENT NOTATIONS.
var value : Double = 65.23 //Basic notation. 65F
value = 0.6523E2 //Scientific notation. 0.6523E2 F