0% found this document useful (0 votes)
11 views16 pages

Lab 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views16 pages

Lab 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

MOBILE PROGRAMMING Prepared by:

Eng. Marwa ELDeeb


I
KOTLIN OPERATOR
Operators are used to perform operations on variables and values.
Kotlin divides the operators into the following groups:
 Arithmetic operators

 Assignment operators
 Comparison operators
Logical operators
ARITHMETIC OPERATOR
ASSIGNMENT OPERATOR
COMPARISON OPERATOR
LOGICAL OPERATOR
KOTLIN STRING
A string contains a collection of characters surrounded by
double quotes.
If you want to create a String without assigning the value
(and assign the value later), you must specify the type while
declaring the variable:
KOTLIN STRING
Use [ ] to access the characters in a string by referring to its
index number.
plus() function to concatenate two strings.
KOTLIN STRING
Concatenation (+) used between strings to add them
together to make a new string .
KOTLIN STRING
length function: to get the length of a string.
indexOf() function returns the index (the position) of the first
occurrence of a specified text in a string (including
whitespace)
KOTLIN CONDITIONS
if statement to specify a block of Kotlin code to be executed
if a condition is true.
else if statement to specify a new condition if the first
condition is false.
Instead of writing many if..else expressions, you can use the
when expression.
The when expression is similar to the switch statement in
Java.
you can also create ranges of values with ".."
KOTLIN CONDITIONS
KOTLIN LOOPS
The while loop loops through a block of code as long as a
specified condition is true.
The do..while loop is a variant of the while loop. This loop will
execute the code block once, before checking if the condition is
true, then it will repeat the loop as long as the condition is true.
The break statement is used to jump out of a loop ” means exist
from the current loop”.
The continue statement breaks one iteration (in the loop), if a
specified condition occurs, and continues with the next iteration
in the loop “means leave the current iteration and starts a new
iteration”.
WHAT IS THE OUTPUT?
WHAT IS THE OUTPUT?
THANKS Eng.Marwa
ELDeeb

You might also like