Kotlin Expression & Statement

In this tutorial you will learn about the Kotlin Expression & Statement and its application with practical example.

Kotlin Expression

An expressions is consist of variables, operators, literals and method calls that evaluates to a value.

Example:-

Here, num1+20 is an expression, the value of the expression is assigned to variable result.

Kotlin Statement

Kotlin statement is an executable statements, that tell the computer to perform a specification action.Program statement can be an input-output statements, arithmetic statements, control statements, simple assignment statements and any other statements and it also includes comments.

Example:-

Here, 25 + 10 is an expression that returns 35, and val result= 25 + 10 is a statement.

Kotlin Block

In Kotlin, block is a group of statement(s) that is enclosed in curly braces { }.

Example:-

 

Recommended:-  Kotlin Companion Objects
In this tutorial we have learn about the Kotlin Expression & Statement and its application with practical example. I hope you will like this tutorial.