SlideShare a Scribd company logo
1 of 18
This work is licensed under the Apache 2.0 License
Intro
Birthday card
Calculator App
DiceRoller
Kotlin
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
Kaustubh Narwade
GitHub
Camp leaders
Sujal Goswami
GitHub
Rishabh Sachan
GitHub
This work is licensed under the Apache 2.0 License
Camp Schedule
TOPIC TIME
Intro (Online) 0:00 - 0:00
Birthday Wish Card App (Offline) 0:00 - 0:00
Dice Roller App (Offiline) 0:00 - 0:00
Calculator (Online) 0:00 - 0:00
Sessions Date
Intro Session | Compose Camp 11th October, 2022
Birthday Wish Card App 12th October, 2022
Dice Roller App 13th October, 2022
Calculator App 14th October, 2022
This work is licensed under the Apache 2.0 License
Recap
● Variables
● functions
● Android Studio
● Birthday wish card
This work is licensed under the Apache 2.0 License
Recap
● Conditionals
● When statement
● Nullability
● Function types
● Repeat function
● Dice Roller App
This work is licensed under the Apache 2.0 License
This work is licensed under the Apache 2.0 License
Variables
fun main() {
val cartTotal = 0
cartTotal = 20
println("Total: $cartTotal")
}
Val cannot be reassignd
fun main() {
var cartTotal = 0
cartTotal = 20
println("Total: $cartTotal")
}
This work is licensed under the Apache 2.0 License
Functions
This work is licensed under the Apache 2.0 License
Use if/else statements to express conditions
This work is licensed under the Apache 2.0 License
When statement
This work is licensed under the Apache 2.0 License
fun main() {
val x: Any = 20
when (x) {
2, 3, 5, 7 -> println("x is a prime number between 1 and 10.")
in 1..10 -> println("x is a number between 1 and 10, but not a prime number.")
is Int -> println("x is an integer number, but not between 1 and 10.")
else -> println("x isn't an integer number.")
}
}
Some Keywords
This work is licensed under the Apache 2.0 License
if/else & when as
expressions
fun main() {
val trafficLightColor = "Black"
val message =
if (trafficLightColor == "Red") "Stop"
else if (trafficLightColor == "Yellow") "Slow"
else if (trafficLightColor == "Green") "Go"
else "Invalid traffic-light color"
println(message)
}
fun main() {
val trafficLightColor = "Amber"
val message = when(trafficLightColor) {
"Red" -> "Stop"
"Yellow", "Amber" -> "Proceed with caution."
"Green" -> "Go"
else -> "Invalid traffic-light color"
}
println(message)
}
This work is licensed under the Apache 2.0 License
Nullability
In Kotlin, there's a distinction between nullable and non-nullable types:
•Nullable types are variables that can hold null.
•Non-null types are variables that can't hold null.
This work is licensed under the Apache 2.0 License
Handle nullable variables
• Use the ?. safe-call operator fun main() {
var favoriteActor: String? = "Sandra Oh"
println(favoriteActor?.length)
}
• Use the ?: Elvis operator
fun main() {
val favoriteActor: String? = "Sandra Oh"
val lengthOfName = favoriteActor?.length ?: 0
println("The number of characters in your
favorite actor's name is $lengthOfName.")
}
Repeat()
This work is licensed under the Apache 2.0 License
Birthday wish card
This work is licensed under the Apache 2.0 License
Dice Roller

More Related Content

Similar to CalculatorApp[1].pptx

Android Study Jams - New to Programming [27th december]
Android Study Jams - New to Programming [27th december]Android Study Jams - New to Programming [27th december]
Android Study Jams - New to Programming [27th december]
PragatiVerma31
 
Beware: Sharp Tools
Beware: Sharp ToolsBeware: Sharp Tools
Beware: Sharp Tools
chrismdp
 

Similar to CalculatorApp[1].pptx (20)

day1.docx
day1.docxday1.docx
day1.docx
 
Beyond php it's not (just) about the code
Beyond php   it's not (just) about the codeBeyond php   it's not (just) about the code
Beyond php it's not (just) about the code
 
Android Study Jams - New to Programming [27th december]
Android Study Jams - New to Programming [27th december]Android Study Jams - New to Programming [27th december]
Android Study Jams - New to Programming [27th december]
 
Getting Started with iBeacons (Designers of Things 2014)
Getting Started with iBeacons (Designers of Things 2014)Getting Started with iBeacons (Designers of Things 2014)
Getting Started with iBeacons (Designers of Things 2014)
 
Compose Camp #1.pptx
Compose  Camp #1.pptxCompose  Camp #1.pptx
Compose Camp #1.pptx
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Nodejsexplained 101116115055-phpapp02
Nodejsexplained 101116115055-phpapp02Nodejsexplained 101116115055-phpapp02
Nodejsexplained 101116115055-phpapp02
 
DSC - Android Study Jams - Session 2
DSC - Android Study Jams - Session 2 DSC - Android Study Jams - Session 2
DSC - Android Study Jams - Session 2
 
Compose Camp S1.pptx
Compose Camp S1.pptxCompose Camp S1.pptx
Compose Camp S1.pptx
 
#FrontConf2017 — Enhance your User (and Developer) Experience with React & Redux
#FrontConf2017 — Enhance your User (and Developer) Experience with React & Redux#FrontConf2017 — Enhance your User (and Developer) Experience with React & Redux
#FrontConf2017 — Enhance your User (and Developer) Experience with React & Redux
 
Android Development | Compose Camp Day 1 | GDSC SEC Sasaram.pdf
Android Development | Compose Camp Day 1 | GDSC SEC Sasaram.pdfAndroid Development | Compose Camp Day 1 | GDSC SEC Sasaram.pdf
Android Development | Compose Camp Day 1 | GDSC SEC Sasaram.pdf
 
Compose Camp Day 1.pdf
Compose Camp Day 1.pdfCompose Camp Day 1.pdf
Compose Camp Day 1.pdf
 
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】
 
Architecture for scalable Angular applications (with introduction and extende...
Architecture for scalable Angular applications (with introduction and extende...Architecture for scalable Angular applications (with introduction and extende...
Architecture for scalable Angular applications (with introduction and extende...
 
Compose Camp Slide Session 1
Compose Camp Slide Session 1Compose Camp Slide Session 1
Compose Camp Slide Session 1
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
Beware: Sharp Tools
Beware: Sharp ToolsBeware: Sharp Tools
Beware: Sharp Tools
 
Compose Camp 2.pdf
Compose Camp 2.pdfCompose Camp 2.pdf
Compose Camp 2.pdf
 
Compose Camp.pdf
Compose Camp.pdfCompose Camp.pdf
Compose Camp.pdf
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hq
 

Recently uploaded

Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Lovely Professional University
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdf
Kamal Acharya
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DrGurudutt
 
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
MohammadAliNayeem
 

Recently uploaded (20)

ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
 
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
RM&IPR M5 notes.pdfResearch Methodolgy & Intellectual Property Rights Series 5
 
Supermarket billing system project report..pdf
Supermarket billing system project report..pdfSupermarket billing system project report..pdf
Supermarket billing system project report..pdf
 
Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2
 
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWINGBRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
BRAKING SYSTEM IN INDIAN RAILWAY AutoCAD DRAWING
 
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdfRESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
RESORT MANAGEMENT AND RESERVATION SYSTEM PROJECT REPORT.pdf
 
How to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdfHow to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdf
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdf
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdf
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
 
Theory for How to calculation capacitor bank
Theory for How to calculation capacitor bankTheory for How to calculation capacitor bank
Theory for How to calculation capacitor bank
 
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbineLow rpm Generator for efficient energy harnessing from a two stage wind turbine
Low rpm Generator for efficient energy harnessing from a two stage wind turbine
 
Electrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission lineElectrostatic field in a coaxial transmission line
Electrostatic field in a coaxial transmission line
 
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
Complex plane, Modulus, Argument, Graphical representation of a complex numbe...
 
solid state electronics ktu module 5 slides
solid state electronics ktu module 5 slidessolid state electronics ktu module 5 slides
solid state electronics ktu module 5 slides
 
Lect_Z_Transform_Main_digital_image_processing.pptx
Lect_Z_Transform_Main_digital_image_processing.pptxLect_Z_Transform_Main_digital_image_processing.pptx
Lect_Z_Transform_Main_digital_image_processing.pptx
 
Online book store management system project.pdf
Online book store management system project.pdfOnline book store management system project.pdf
Online book store management system project.pdf
 
Attraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxAttraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptx
 

CalculatorApp[1].pptx

  • 1. This work is licensed under the Apache 2.0 License
  • 2. Intro Birthday card Calculator App DiceRoller Kotlin This work is licensed under the Apache 2.0 License
  • 3. This work is licensed under the Apache 2.0 License Kaustubh Narwade GitHub Camp leaders Sujal Goswami GitHub Rishabh Sachan GitHub
  • 4. This work is licensed under the Apache 2.0 License Camp Schedule TOPIC TIME Intro (Online) 0:00 - 0:00 Birthday Wish Card App (Offline) 0:00 - 0:00 Dice Roller App (Offiline) 0:00 - 0:00 Calculator (Online) 0:00 - 0:00 Sessions Date Intro Session | Compose Camp 11th October, 2022 Birthday Wish Card App 12th October, 2022 Dice Roller App 13th October, 2022 Calculator App 14th October, 2022
  • 5. This work is licensed under the Apache 2.0 License Recap ● Variables ● functions ● Android Studio ● Birthday wish card
  • 6. This work is licensed under the Apache 2.0 License Recap ● Conditionals ● When statement ● Nullability ● Function types ● Repeat function ● Dice Roller App
  • 7. This work is licensed under the Apache 2.0 License
  • 8. This work is licensed under the Apache 2.0 License Variables fun main() { val cartTotal = 0 cartTotal = 20 println("Total: $cartTotal") } Val cannot be reassignd fun main() { var cartTotal = 0 cartTotal = 20 println("Total: $cartTotal") }
  • 9. This work is licensed under the Apache 2.0 License Functions
  • 10. This work is licensed under the Apache 2.0 License Use if/else statements to express conditions
  • 11. This work is licensed under the Apache 2.0 License When statement
  • 12. This work is licensed under the Apache 2.0 License fun main() { val x: Any = 20 when (x) { 2, 3, 5, 7 -> println("x is a prime number between 1 and 10.") in 1..10 -> println("x is a number between 1 and 10, but not a prime number.") is Int -> println("x is an integer number, but not between 1 and 10.") else -> println("x isn't an integer number.") } } Some Keywords
  • 13. This work is licensed under the Apache 2.0 License if/else & when as expressions fun main() { val trafficLightColor = "Black" val message = if (trafficLightColor == "Red") "Stop" else if (trafficLightColor == "Yellow") "Slow" else if (trafficLightColor == "Green") "Go" else "Invalid traffic-light color" println(message) } fun main() { val trafficLightColor = "Amber" val message = when(trafficLightColor) { "Red" -> "Stop" "Yellow", "Amber" -> "Proceed with caution." "Green" -> "Go" else -> "Invalid traffic-light color" } println(message) }
  • 14. This work is licensed under the Apache 2.0 License Nullability In Kotlin, there's a distinction between nullable and non-nullable types: •Nullable types are variables that can hold null. •Non-null types are variables that can't hold null.
  • 15. This work is licensed under the Apache 2.0 License Handle nullable variables • Use the ?. safe-call operator fun main() { var favoriteActor: String? = "Sandra Oh" println(favoriteActor?.length) } • Use the ?: Elvis operator fun main() { val favoriteActor: String? = "Sandra Oh" val lengthOfName = favoriteActor?.length ?: 0 println("The number of characters in your favorite actor's name is $lengthOfName.") }
  • 17. This work is licensed under the Apache 2.0 License Birthday wish card
  • 18. This work is licensed under the Apache 2.0 License Dice Roller