Android basic operators || Kotlin Tutorial on Operators

 

Android basic operators :

In this part of the tutorial we will be dealing with android basic operators like addition, subtraction etc. A best example for the operators is calculator app which has almost utilized all sorts of  operators.

The importance of this tutorial on android basic operators is to know the usage of operators with the help of variables. As this gives you the basic learning experience of problem solving.

We would be performing operations on variables showing their usage and also in further tutorials we will be looking forward to accept dynamic values and handling them evn in the same style.

Let’s get ahead and see tutorial on android basic operators

 

Basic Addition :

In this example on android basic operators we will try to add two numbers and store the result in the result variable.

If you have missed my previous tutorial on variables so you will get a basic idea of how to declare variables here.

Declare two variables with values and also we are declaring the type of the variable here.

var a : Int = 10
var b : Int = 20

 

Declare third variable for storing result

var total : Int

 

perform operation

total = a + b

 

In the same way we can perform remaining operators like subtraction, multiplication and division.As these are the most commonly used.

 

Subtraction

total = a - b

 

Multiplication

total = a * b

 

Division

total = a / b

 

Not only basic operations there are many more operations that can be performed and also few operations even require other data types like float and double so that we can even get the minute decimals.

In coming tutorials we will cover them stay tuned to receive the updates.

 

If you have any query’s in this tutorial on android basic operators do let us know in the comment section below.If you like this tutorial do like and share us for more interesting updates.

For complete video tutorial on android basic operators visit this link below

 

 

Show Buttons
Hide Buttons
Read previous post:
Kotlin Variable Declaration || Kotlin, Android

  In this tutorial we will go through the variables usage in Kotlin though you have a knowledge of variables...

Close