Kotlin Programming Language – Complete Course

Step 1: Intro and First program

Lesson 1.  Installing Java on Windows

In order to do start kotlin (anroid studio) we must install the Java compiler and the Java virtual machine. These tools can be downloaded from:
Java SE Development Kit (download Windows x64 or if you have a 32-bit operating system install Windows x86).

Lesson 2.  Installation of Kotlin using IntelliJ IDEA

Kotlin is a fairly new programming language developed by JetBrains and lately is taking flight thanks among other things like being the…

Lesson 3.  Steps to create first program in Kotlin

We saw in the previous concept that when we started IntelliJ IDEA and not yet created a project the following screen appears.

Lesson 4.  Variables Types in Kotlin 

A variable is a shell where there is a value. It consists of a name and belongs to a type.

In the Kotlin language if we need to store an integer value we can define a variable of type:

Byte, Shorts, Int, Long

Lesson 5.  Keyboard Data Entry on the Console in Kotlin

Keyboard Data Entry on the Console in Kotlin. When we use the Console to display information on screen we use the print and println functions. If we need to enter data by keyboard we can use the readLine function.

Spep 2: Conditional Statements

Lesson 6. Conditional if Statement in Kotlin

Conditional if Statement in Kotlin Language. When a decision is made, conditional structures appear. In our daily life we have situations where we have to decide.

Lesson 7. If  Statements as an expression in Kotlin 

If condition as an expression in Kotlin language. In Kotlin there exists the possibility that the conditional if structure returns a value, a characteristic not common to other programming languages.

Lesson 8. Nested If conditional Statement in Kotlin

Nested If conditional Statement in Kotlin language. We say that a conditional structure is nested when by the real or false branch of a conditional structure there is another conditional structure.

Lesson 9. Composite conditions with logical operators in Kotlin Language

So far we have seen operators:
 Relational (>, <,> =, <=, ==,! =)
 Mathematicians (+, -, *, /,%)

But we are missing other essential operators:

 Logical (&&, ||)

These two operators are used primarily in conditional structures to group several simple conditions.

Lesson 10. WHEN Conditional structure in Kotlin language

In addition to the conditional structure “if”,  Kotlin gives us a conditional structure for situations we have to verify multiple conditions that are solved with “if” nested called WHEN Conditional structure.

Lesson 11. Conditional structure WHEN with ARGUMENT in kotlin language

WHEN Condition with ARGUMENT in kotlin language. We have a second way to use the when statement in the Kotlin language is by passing an argument immediately after the keyword when.

Step 3: Looping Structure

Lesson 12. While Looping structure in Kotlin Language

While Loop in Kotlin Language. So far we have used SEQUENTIAL and CONDITIONAL structures. There is another type of structures as important as the previous ones are LOOPING structures.

 A looping structure allows you to execute a statement or an instruction set several times.

Lesson 13. Do / while Looping Statement in kotlin Language

The do / while Looping structure is another looping structure, which executes its repetitive block at least once, unlike the while that might not execute the block.
This repetitive structure is used when we know in advance that at least once the repetitive block will be executed.

Lesson 14. For loop and range expressions in Kotlin Language

For loop and range expressions in Kotlin Language. The for loop structure has some variants in Kotlin, in this concept we will see the for loop structure with range expressions.

Step 4: Functions (Methods) in Kotlin

Lesson 15. Functions: parameters in Kotlin language

Function parameters in Kotlin language. We saw in the previous concept that a function solves a part of our algorithm.

On the one hand we have the declaration of the function by means of a name and the algorithm of the function next.

Lesson 16. Concept of functions in Kotlin language

Concept of functions in Kotlin language. So far we have worked solving the whole problem in the main function proposed in Kotlin.

This way of organizing a program can only be carried out if it is very small (tens of lines).

Lesson 17. Functions: with data return in Kotlin Language

Functions with data return in Kotlin Language. We saw that a function is defined by a name and that it can receive data by means of its parameters.

Lesson 18 – Functions: with a single expression in Kotlin Language

Functions with a single expression in Kotlin Language. The functions of a single expression can be expressed in Kotlin without the block of keys and by an assignment indicate the value that it returns.

Lesson 19 – Functions with parameters with default value in kotlin

In Kotlin you can define parameters and assign them a data in the same header of the function. Then when we call the function we can or do not send a value to the parameter.

lesson 20 – Call to function with named arguments in Kotlin language

Call to function with named arguments in Kotlin language. This feature of Kotlin allows us to call the function indicating in any order the parameters of the same, but we must specify in the call the name of the parameter and the value to send.

Lesson 21 – Functions: internal or local in Kotlin language

Kotlin supports local or internal functions, ie a function within another function.

Step 5: Arrays in Kotlin Language

Lesson: 22 – Arrays: concepts in kotlin language

In this section, we will look at other types of variables that allow us to store a set of data in a single variable. We use variables of a different type for data storage (Int, Float, Double, Byte, Short, Long, Char, Boolean variables).

Lesson 23 –  parameters and data return type array

We have seen the objective of putting functions into a program and that they can receive data by means of parameters and return a data.

Step 6: Object Oriented Programming

Lesson 24 – Object-oriented programming concepts in kotlin Language

Kotlin allows us to use the methodology of object-oriented programming.

Object-oriented programming (OOP) will introduce concepts of object, class, property, field, method, constructor, inheritance, and so on. And all these issues will be solved problems solved.

Lesson 25: – Object Oriented Programming – Class Builder in kotlin

Kotlin constructor has the following characteristics:

It is the first method to be executed.

It runs automatically.

Can not return data.

It runs only once.

A constructor aims to initialize attributes.

A class may have several constructors but only one is the principal.

Lesson 26: Calling methods from another method of the same class – kotlin

So far all the problems raised have called the methods from where we define an object of that class, for example:

Val persona1 = Person (“Juan”, 12) Print () Person1.MajorAge ()

We use the syntax:

[Name of the object] [method name]

Lesson 27: Class collaboration in Kotlin Language

Normally a problem solved with the methodology of object oriented programming does not involve a single class, but there are many classes that interact and communicate.

Lesson 28: OOP – private and public access modifiers in Kotlin

One of the fundamental principles of object-oriented programming is encapsulation, this is achieved by grouping a series of methods and properties within a class. In Kotl…

Lesson 29: OOP – Properties – Methods SET and GET in Kotlin

We have seen that when we define a public property we can access its content to modify it or to consult it from where we defined an object. To a property, we can associat…

lesson 30: OOP – data class in Kotlin language

Redefining methods of a data class in kotlin.We have said that a class encapsulates a set of functionalities (methods) and data (properties) In many situations, w…

Lesson 31: OOP – Enum class in kotlin Language

Kotlin we have another special type of class that is declared with the keywords enum class. They are used to define a set…

Lesson 32: OOP – Named Object in kotlin language

Another feature of the Kotlin language is to be able to define an object immediately without having to declare a class. A ne…

lesson 33: OOP – inheritance in Kotlin Language

We saw in previous concepts that two classes can be related by the collaboration (in one of them we define a property of the type of the other…

Lesson: 34 OOP – inheritance – abstract classes in kotlin language

In some situations we have methods and properties common to a set of classes, we can group these methods and properties into an abstract class. There is a special syntax…

Lesson 35: declaration and implementation of interfaces in Kotlin

The syntax in Kotlin for declaring an interface is:An interface declares a series of methods and properties that must be implemented later by one or more classes,…

Lesson 36: Arrangements with Objects in kotlin

We said that an array is a data structure that allows storing a set of data of the same type. With a unique name an arrangement is defined and by means of a subscript we…

Lesson 37: – Higher Order Functions in kotlin

Kotlin is an object-oriented language but introduces features in functional languages that allow us to create a clearer and more expressive code. One of the characteristi…

Step 8: Lambda in Kotlin Language

lesson 38 – Lambda expressions in Kotlin language

A lambda expression is when we send an anonymous function directly to a higher-order function. It is more common to send a lambda expression instead of sending the refere…

Lesson 39: Lambda Expression with Array Data Types

We saw in previous concepts that for the basic types; Byte, Short, Int, Long, Float, Double, Char and Boolean we have a series of classes to define arrays of these types:…

Lesson 40: Access to external variables to the lambda expression

We have seen in previous concepts that a lambda expression is when we send an anonymous function directly to a higher-order function. Within the lambda function, we can a…

Step 9: Others

Lesson 41 – Extension Functions In Kotlin language

Another very useful feature of Kotlin for programmers is the concept of extension functions. Using the extension functions Kotlin allows us to add other methods to an exi…

Lesson 42 – Overloading operators in Kotlin Programming Language

The Kotlin language allows certain operators to be overloaded and to act in different ways according to the object that is applied.

Lesson 43 – Functions: variable number of parameters

ContentsSpread operatorIn the Kotlin language, a method of a class or function can receive a variable amount of parameters using the keyword “vararg” prior to…

Lesson 44: Null values in variables Kotlin Programming language

So far we have not analyzed how Kotlin Programming language treats null values (null) in the definition of variables. In Kotlin Programming language,…

Lesson 45 – Kotlin programming language Collections

Kotlin provides a wide range of classes for managing collections of data. We have already seen some of the classes that allow managing collections: For basic data types (…

Lesson 46 – List and MutableList in Kotlin Programming Language

ContentsCreation of an unchanging list.Creating a mutable list.A list is an ordered collection of data. An item can be retrieved by the position in the collection. We can…

Lesson 47 – Map and MutableMap in Kotlin Programming language

The Map data structure uses a key to access a value. The subindex can be any type of class, as well as its value We can relate it to concepts we know: A traditional dicti…

Lesson 48 -Set and MutableSet in Kotlin Programming Language.

The Set and MutableSet (set) classes allow you to store a set of elements that must be all different. It does not allow storing repeated data.

A set is a collection of items without a specific order, unlike lists.

Lesson 49: – Package and Import – kotlin Programming language

The packages allow us to group classes, functions, objects, constants, etc. In a namespace for ease of use and maintenance. The packages group functionalities on a specif…