Kotlin Data types

Hello Everyone, 

Here in this blog, we are going to learn the basics of Kotlin Programming language.

Kotlin basics include variables, datatype, comments, operators etc. So let us begin 😊

 

Kotlin Datatypes

1. Integer Datatype :

     Integer data type can be of the following type : 

     -> Byte :      8 bit 

     -> Short :    16 bit

     -> Int :         24 bit

     -> Long :     32 bit 

     Example :

     var byteVar : Byte = Byte.MIN_VALUE        // Byte example

     var shortVar : Short = Short.MIN_VALUE   // Short example

     var intVar : Int = Int.MIN_VALUE        // Int example

     var longVar : Long = Long.MIN_VALUE   // Long example

2. Floating-point Data type

     Floating point data types are datatype which include represent decimal values.

     These can be of the following types.

     -> Float : 32 bits

     -> Double : 64 bits 

     Exampl

     var floatVar : Float = Float.MIN_VALUE        // Float example

     var doubleVar : Short = Double.MIN_VALUE   // Double example

 

3. Boolean Data type

     Boolean data types represent only one bit of information that is either true or  false.

     var booleanVar : Boolean = true        // Boolean example

4. Char Data type

     Character datatype represent one character. eg: small letters (a-z), Capital Letter (A-Z), digits (0-9) 

     var charVar : Char = 'a'        // char example 

 

     

Comments