SlideShare a Scribd company logo
This work is licensed under the Apache 2.0 License
Kotlin Programming Language
Welcome to Android
Study Jams
Wi-Fi : Super1@dmin
This work is licensed under the Apache 2.0 License
Comments
Print Statement
The println() or print() function is used to output values/text.
SYNTAX :- print(“Welcome”)
println(“To The ASJ”)
Comments can be used to explain Kotlin code, and to make it more readable. It can also be used
to prevent execution when testing alternative code.
SYNTAX :- // This is how you write single line comments.
/* This is how you write multi-line comments. */
Variables
The general rule for Kotlin variables are:
● Names can contain letters, digits, underscores, and dollar signs
● Names should start with a letter
● Names can also begin with $ and _
● Names are case sensitive ("myVar" and "myvar" are different variables)
● Names should start with a lowercase letter and it cannot contain whitespace
● Reserved words (like Kotlin keywords, such as var or String) cannot be used as names
Variables are containers for storing data values.
SYNTAX :- var variableName = value
val variableName = value
Data Types
Different Types of data types are:
● Int (For Numbers)
● Double (For Decimal Numbers)
● Char (For Letters)
● Boolean (For True Or False)
● String (For a series of Characters)
myNum = 5
myDoubleNum = 10.
myLetter = ‘K’
myBoolean = true
myString = “Hello”
Operators
Booleans
SYNTAX :- val isKotlinFun : true
val isFishTasty : false
● Arithmetic Operators : + , - , * , / , % , ++ , –
● Assignment Operators : =
● Comparison Operators : == , != , > , < , >= , <=
● Logical Operators : && , || , !
Conditional Statements
● Use if to specify a block of code to be executed, if a specified condition
is true
● Use else to specify a block of code to be executed, if the same
condition is false
● Use else if to specify a new condition to test, if the first condition is
false
● Use when to specify many alternative blocks of code to be executed
SYNTAX :- if(condition){
// if condition is true execute
}
Loops
A Do While loop will execute the code block once, before checking the
condition is true, then it will repeat the loop until it’s true.
SYNTAX :- do{
Code block to be executed
}
while(condition)
A While loop loops through a code as long as a specified condition is true.
SYNTAX :- while(condition){
Code block to be executed
}
Loops
A For loop loops through a array, ranges and other things that contains
a specific number of elements.
SYNTAX :- for(condition){
Code block to be executed
}
Ranges
Ranges are a special way to represent a sequence of numbers.
We use “..” operator to use a range
Arrays
● Array Slicing Operations
● Length/Size
● Loop through a Array
Arrays are used to store multiple values in a single variable, instead
of creating separate variables for each value.
SYNTAX :- val cars = arrayOf(“Ford”,”BMW”,”Volvo”)
Function
A function is a block of code which only runs when it is called. You
can pass data, known as parameters, into a function.
SYNTAX :- fun functionName(){
//Code to be executed
}
Fun functionName():Int{
//Code to be executed
}
BREAK
Class and Object
This work is licensed under the Apache 2.0 License
QnA Session

More Related Content

PPTX
Webdev bootcamp
PDF
Basic JavaScript Tutorial
PPTX
Introduction to JavaScript Programming
PPTX
Learn TypeScript from scratch
PPTX
Typescript
PPTX
Java Script An Introduction By HWA
PPTX
Learn To Code: Introduction to c
PDF
Sharable of qualities of clean code
Webdev bootcamp
Basic JavaScript Tutorial
Introduction to JavaScript Programming
Learn TypeScript from scratch
Typescript
Java Script An Introduction By HWA
Learn To Code: Introduction to c
Sharable of qualities of clean code

What's hot (20)

DOC
Typescript Basics
PDF
8 introduction to_java_script
PDF
Real Browser Check Scripting Guide - Rigor Monitoring
PPTX
Javascripts. pptt
PPTX
Introduction to JavaScript Programming
PPT
Javascript Basics
PDF
TypeScript and Angular workshop
PPT
Java script final presentation
PPT
Java Script
PPTX
Java script
PPTX
Java script
PPTX
Java script
PDF
Contracts in Ruby - Vladyslav Hesal
PDF
Javascript Roadmap - The Basics
DOCX
Java script basics
PPTX
Lecture 5 javascript
PPT
JavaScript Variables
PPTX
Introduction to JavaScript
PPTX
Placement and variable 03 (js)
PPTX
Javascript
Typescript Basics
8 introduction to_java_script
Real Browser Check Scripting Guide - Rigor Monitoring
Javascripts. pptt
Introduction to JavaScript Programming
Javascript Basics
TypeScript and Angular workshop
Java script final presentation
Java Script
Java script
Java script
Java script
Contracts in Ruby - Vladyslav Hesal
Javascript Roadmap - The Basics
Java script basics
Lecture 5 javascript
JavaScript Variables
Introduction to JavaScript
Placement and variable 03 (js)
Javascript
Ad

Similar to Kotlin programming language (20)

PDF
Compose Camp
PPTX
kotlin-nutshell.pptx
PPTX
Unit 1 part for information technology 1.pptx
PDF
Compose Camp - Session1.pdf
PPTX
Compose Code Camp (1).pptx
PDF
9054799 dzone-refcard267-kotlin
PPTX
Kotlin
PPTX
GDSC_day_1.pptx
PDF
Compose Camp Session 1.pdf
PPTX
Introduction to Kotlin.pptx
PPTX
01 Introduction to Kotlin - Programming in Kotlin.pptx
PDF
Kotlin Jump Start Online Free Meetup (June 4th, 2024)
PPTX
Kotlin InDepth Tutorial for beginners 2022
PDF
Privet Kotlin (Windy City DevFest)
PPTX
Compose_camp_Day_1.pptx
PDF
Basics of kotlin ASJ
PDF
Kotlin- Basic to Advance
PPTX
Compose #1.pptx
PPTX
Introduction to KOTLIN.pptx
PPTX
Android Workshops Day 1 , GDSC JNU. Host: Surya Kanta Ghosh
Compose Camp
kotlin-nutshell.pptx
Unit 1 part for information technology 1.pptx
Compose Camp - Session1.pdf
Compose Code Camp (1).pptx
9054799 dzone-refcard267-kotlin
Kotlin
GDSC_day_1.pptx
Compose Camp Session 1.pdf
Introduction to Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx
Kotlin Jump Start Online Free Meetup (June 4th, 2024)
Kotlin InDepth Tutorial for beginners 2022
Privet Kotlin (Windy City DevFest)
Compose_camp_Day_1.pptx
Basics of kotlin ASJ
Kotlin- Basic to Advance
Compose #1.pptx
Introduction to KOTLIN.pptx
Android Workshops Day 1 , GDSC JNU. Host: Surya Kanta Ghosh
Ad

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
KodekX | Application Modernization Development
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Advanced methodologies resolving dimensionality complications for autism neur...
Diabetes mellitus diagnosis method based random forest with bat algorithm
KodekX | Application Modernization Development
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Programs and apps: productivity, graphics, security and other tools
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MYSQL Presentation for SQL database connectivity
Building Integrated photovoltaic BIPV_UPV.pdf
cuic standard and advanced reporting.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Kotlin programming language

  • 1. This work is licensed under the Apache 2.0 License Kotlin Programming Language Welcome to Android Study Jams Wi-Fi : Super1@dmin
  • 2. This work is licensed under the Apache 2.0 License
  • 3. Comments Print Statement The println() or print() function is used to output values/text. SYNTAX :- print(“Welcome”) println(“To The ASJ”) Comments can be used to explain Kotlin code, and to make it more readable. It can also be used to prevent execution when testing alternative code. SYNTAX :- // This is how you write single line comments. /* This is how you write multi-line comments. */
  • 4. Variables The general rule for Kotlin variables are: ● Names can contain letters, digits, underscores, and dollar signs ● Names should start with a letter ● Names can also begin with $ and _ ● Names are case sensitive ("myVar" and "myvar" are different variables) ● Names should start with a lowercase letter and it cannot contain whitespace ● Reserved words (like Kotlin keywords, such as var or String) cannot be used as names Variables are containers for storing data values. SYNTAX :- var variableName = value val variableName = value
  • 5. Data Types Different Types of data types are: ● Int (For Numbers) ● Double (For Decimal Numbers) ● Char (For Letters) ● Boolean (For True Or False) ● String (For a series of Characters) myNum = 5 myDoubleNum = 10. myLetter = ‘K’ myBoolean = true myString = “Hello”
  • 6. Operators Booleans SYNTAX :- val isKotlinFun : true val isFishTasty : false ● Arithmetic Operators : + , - , * , / , % , ++ , – ● Assignment Operators : = ● Comparison Operators : == , != , > , < , >= , <= ● Logical Operators : && , || , !
  • 7. Conditional Statements ● Use if to specify a block of code to be executed, if a specified condition is true ● Use else to specify a block of code to be executed, if the same condition is false ● Use else if to specify a new condition to test, if the first condition is false ● Use when to specify many alternative blocks of code to be executed SYNTAX :- if(condition){ // if condition is true execute }
  • 8. Loops A Do While loop will execute the code block once, before checking the condition is true, then it will repeat the loop until it’s true. SYNTAX :- do{ Code block to be executed } while(condition) A While loop loops through a code as long as a specified condition is true. SYNTAX :- while(condition){ Code block to be executed }
  • 9. Loops A For loop loops through a array, ranges and other things that contains a specific number of elements. SYNTAX :- for(condition){ Code block to be executed } Ranges Ranges are a special way to represent a sequence of numbers. We use “..” operator to use a range
  • 10. Arrays ● Array Slicing Operations ● Length/Size ● Loop through a Array Arrays are used to store multiple values in a single variable, instead of creating separate variables for each value. SYNTAX :- val cars = arrayOf(“Ford”,”BMW”,”Volvo”)
  • 11. Function A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. SYNTAX :- fun functionName(){ //Code to be executed } Fun functionName():Int{ //Code to be executed }
  • 12. BREAK
  • 14. This work is licensed under the Apache 2.0 License QnA Session