SlideShare a Scribd company logo
1 of 40
Download to read offline
Compose Camp
Android Basics with Compose:
Unit 1
Today's Speakers
Bhavik Kothari
Gopal Meena
Co-Facilitator
Facilitator
Compose Camp is a hands-on introduction
to learning how you can build Android apps
with Jetpack Compose.
What is Compose Camp?
● Computer & headphones
● Internet connection
● Android Studio
● Install Android studio in windows
● Install Android studio in macOS
Prerequisites
●Build your first Android apps
●Set up Android Studio on your computer
●Learn the basics of the Kotlin programming language
●Learn Jetpack Compose
●Discover resources to continue learning
Compose Camp Learning Objectives
1. Why are you here?
2. What are you goals?
3. How do you plan to achieve them?
https://developers.google.com/profile/u/me/dashboard
Create your google developer profile:
Android Basics
with Compose Course
Unit 1: Your first Android
App
First Pathway
Take a Quiz
Earn Exciting badges!
Google Developer Profile
Carrie

Sawyer
TOPIC TIME
Introduction
Your first program in Kotlin
Create and use variables in Kotlin
Create and use functions in Kotlin
Break
Setting up Android Studio
Making your first project in Android
Studio Wrap Up
5:00 - 5:20
5:20 - 5:30
5:30 - 5:40
5:40 - 5:50
5:50 - 6:00
6:00 - 6:10
6:10 - 6:30
6:30 - 6:40
Session Overview
Kotlin Programming Language
Use Kotlin to start writing Android
apps. Kotlin helps developers be
more
productive.
Kotlin Playground
Write and run Kotlin code in
the browser.
Program
Step by step instructions for
what the computer should do.
Output:
Hello, world!
fun main() {
println("Hello, world!") }
main Function
The main function is the entry
point, or starting point, of the
program.
Start here
Output:
Hello, world!
fun main() {
println("Hello, world!")
}
A container for a single piece of

data.
Variables


My name is and I am years old.
Variables
Name value: Meghan
Age value: 28



Output:
Name value: Janet
Age value: 49



Output:
My name is Meghan and I
am 28 years old
My name is Janet and I

am 49 years old


Name


Age
Basic data types
Kotlin Data type What kind of data it can contain Example literal values
Int
Float
String
Double
Boolean
Text
Decimal number
Whole integer number
true or false. Use this data type when
there are only two possible values.
Decimal number (less precise than a Double).
Has an f or F at the end of the number.
“Add contact”
“Search”


32
-59873
2.0
-37123.9999
5.0f
-1630.209f
true
false
val keyword
var keyword
Use when you expect the variable value will
not change.


Example: name
Use when you expect the variable value can
change.


Example: age
Defining a variable
Defining a variable
All variables must have a name.
fun main() {
val name: String = "Meghan"
var age: Int = 28
}
Defining a variable
Data type is the type of
data that the variable holds.
fun main() {
val name: String = "Meghan"
var age: Int = 28
}
The initial value is the value that
is stored in the variable.
Functions
A function is a segment of a program that
performs a specific task.
You can have many functions in your program or
only a single one.
Defining a function
Functions begin with the
fun keyword.
fun displayIntroduction() {
}
Defining a function
Functions have a name so that
they can be called.
fun displayIntroduction() {
}
Defining a function
Functions need a set of parentheses

after the function name in order to

surround the function inputs.
fun displayIntroduction() {
}
Defining a function
The curly braces make up the
function body and contain the
instructions needed to
execute a task.
fun displayIntroduction( ) {
}
Putting it together
fun displayIntroduction() {
// We will fill this out!
}
Output:
Hi I’m Meghan and I am 28 years old
Putting it together
fun displayIntroduction() {
val name : String = "Meghan"
val age : Int = 28
println("Hi I'm $name and I am $age years old")
}
Putting it together
fun main() {
displayIntroduction()
}
fun displayIntroduction() {
val name : String = "Meghan"
val age : Int = 28
println("Hi I'm $name and I am $age years old") }
Output:
Hi I’m Meghan and I am 28 years old
This work is licensed under the Apache 2.0

License
Returning in a function
We can return an output from a

function as per its defined

output datatype.
fun displayIntroduction() : String {
return “HelloWorld”;
}
Parameters of a function
We can pass extra information

into a function via parameters

which are declared between the

parentheses.
fun add(n1 : Int, n2 : Int) {
return n1 + n2
}
Parameters of a function
These parameters can also have
default values.
fun add(n1 : Int = 0, n2 : Int = 0) {

return n1 + n2
}
Arguments of a function
While calling a function in another

function, the values we pass to

the parameters defined are

known as Arguments.
fun main() {
var a : Int = 2
var b : Int = 3
println(add(a, b))
}
Work on Unit 1, Pathway 1
Have a Question? Just ask
What’s coming next:
A live coding session in which you are going to build an exciting application:
Budget

Tracker
Share what you’ve
learned using
.#ComposeCamp
on social media
For a chance to be featured by
Android, submit your tips on

learning Compose to

goo.gle/compose-tips
See you at the next Compose Camp Session!
Optional resources to check out:
●
●
●
●
●
●
●
Official Android Developers Site: developer.android.com
Official Android Developers Blog (for announcements)
Android Developers Medium Blog (for more technical articles)
Android Developers YouTube channel
Follow @AndroidDev on Twitter
Follow @AndroidDev on LinkedIn
Subscribe to the Android Developer Newsletter

More Related Content

Similar to Compose Camp - Intro.pdf.pdf

Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingHock Leng PUAH
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console ProgramHock Leng PUAH
 
Visual basic asp.net programming introduction
Visual basic asp.net programming introductionVisual basic asp.net programming introduction
Visual basic asp.net programming introductionHock Leng PUAH
 
PE1 Module 4.ppt
PE1 Module 4.pptPE1 Module 4.ppt
PE1 Module 4.pptbalewayalew
 
Compose Camp Slide Session 1
Compose Camp Slide Session 1Compose Camp Slide Session 1
Compose Camp Slide Session 1AkshatBajpai12
 
Compose Camp Session 2
Compose Camp Session 2Compose Camp Session 2
Compose Camp Session 2AkshatBajpai12
 
Visual Basic Review - ICA
Visual Basic Review - ICAVisual Basic Review - ICA
Visual Basic Review - ICAemtrajano
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answersQuratulain Naqvi
 
Unit 2function in python.pptx
Unit 2function in python.pptxUnit 2function in python.pptx
Unit 2function in python.pptxvishnupriyapm4
 
Functional Programming in C#
Functional Programming in C#Functional Programming in C#
Functional Programming in C#Giorgio Zoppi
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdfziyadaslanbey
 
Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharpDaniele Pozzobon
 
Presentation on design pattern software project lll
 Presentation on design pattern  software project lll  Presentation on design pattern  software project lll
Presentation on design pattern software project lll Uchiha Shahin
 
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxJLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxvrickens
 
1. DSA - Introduction.pptx
1. DSA - Introduction.pptx1. DSA - Introduction.pptx
1. DSA - Introduction.pptxhara69
 

Similar to Compose Camp - Intro.pdf.pdf (20)

Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem Solving
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console Program
 
Visual basic asp.net programming introduction
Visual basic asp.net programming introductionVisual basic asp.net programming introduction
Visual basic asp.net programming introduction
 
PE1 Module 4.ppt
PE1 Module 4.pptPE1 Module 4.ppt
PE1 Module 4.ppt
 
Compose Camp Slide Session 1
Compose Camp Slide Session 1Compose Camp Slide Session 1
Compose Camp Slide Session 1
 
Compose Camp Session 2
Compose Camp Session 2Compose Camp Session 2
Compose Camp Session 2
 
Visual Basic Review - ICA
Visual Basic Review - ICAVisual Basic Review - ICA
Visual Basic Review - ICA
 
C function
C functionC function
C function
 
Python-Cheat-Sheet.pdf
Python-Cheat-Sheet.pdfPython-Cheat-Sheet.pdf
Python-Cheat-Sheet.pdf
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Unit 2function in python.pptx
Unit 2function in python.pptxUnit 2function in python.pptx
Unit 2function in python.pptx
 
Functional Programming in C#
Functional Programming in C#Functional Programming in C#
Functional Programming in C#
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdf
 
Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharp
 
Presentation on design pattern software project lll
 Presentation on design pattern  software project lll  Presentation on design pattern  software project lll
Presentation on design pattern software project lll
 
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxJLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docx
 
1. DSA - Introduction.pptx
1. DSA - Introduction.pptx1. DSA - Introduction.pptx
1. DSA - Introduction.pptx
 
pythonQuick.pdf
pythonQuick.pdfpythonQuick.pdf
pythonQuick.pdf
 

Recently uploaded

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 

Recently uploaded (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 

Compose Camp - Intro.pdf.pdf

  • 1. Compose Camp Android Basics with Compose: Unit 1
  • 2. Today's Speakers Bhavik Kothari Gopal Meena Co-Facilitator Facilitator
  • 3. Compose Camp is a hands-on introduction to learning how you can build Android apps with Jetpack Compose. What is Compose Camp?
  • 4. ● Computer & headphones ● Internet connection ● Android Studio ● Install Android studio in windows ● Install Android studio in macOS Prerequisites
  • 5. ●Build your first Android apps ●Set up Android Studio on your computer ●Learn the basics of the Kotlin programming language ●Learn Jetpack Compose ●Discover resources to continue learning Compose Camp Learning Objectives
  • 6. 1. Why are you here? 2. What are you goals? 3. How do you plan to achieve them?
  • 9. Unit 1: Your first Android App
  • 14. TOPIC TIME Introduction Your first program in Kotlin Create and use variables in Kotlin Create and use functions in Kotlin Break Setting up Android Studio Making your first project in Android Studio Wrap Up 5:00 - 5:20 5:20 - 5:30 5:30 - 5:40 5:40 - 5:50 5:50 - 6:00 6:00 - 6:10 6:10 - 6:30 6:30 - 6:40 Session Overview
  • 15. Kotlin Programming Language Use Kotlin to start writing Android apps. Kotlin helps developers be more productive.
  • 16. Kotlin Playground Write and run Kotlin code in the browser.
  • 17. Program Step by step instructions for what the computer should do. Output: Hello, world! fun main() { println("Hello, world!") }
  • 18. main Function The main function is the entry point, or starting point, of the program. Start here Output: Hello, world! fun main() { println("Hello, world!") }
  • 19. A container for a single piece of data. Variables
  • 20. 
 My name is and I am years old. Variables Name value: Meghan Age value: 28
 Output: Name value: Janet Age value: 49
 Output: My name is Meghan and I am 28 years old My name is Janet and I am 49 years old 
 Name 
 Age
  • 21. Basic data types Kotlin Data type What kind of data it can contain Example literal values Int Float String Double Boolean Text Decimal number Whole integer number true or false. Use this data type when there are only two possible values. Decimal number (less precise than a Double). Has an f or F at the end of the number. “Add contact” “Search” 32 -59873 2.0 -37123.9999 5.0f -1630.209f true false
  • 22. val keyword var keyword Use when you expect the variable value will not change. Example: name Use when you expect the variable value can change. Example: age Defining a variable
  • 23. Defining a variable All variables must have a name. fun main() { val name: String = "Meghan" var age: Int = 28 }
  • 24. Defining a variable Data type is the type of data that the variable holds. fun main() { val name: String = "Meghan" var age: Int = 28 } The initial value is the value that is stored in the variable.
  • 25. Functions A function is a segment of a program that performs a specific task. You can have many functions in your program or only a single one.
  • 26. Defining a function Functions begin with the fun keyword. fun displayIntroduction() { }
  • 27. Defining a function Functions have a name so that they can be called. fun displayIntroduction() { }
  • 28. Defining a function Functions need a set of parentheses after the function name in order to surround the function inputs. fun displayIntroduction() { }
  • 29. Defining a function The curly braces make up the function body and contain the instructions needed to execute a task. fun displayIntroduction( ) { }
  • 30. Putting it together fun displayIntroduction() { // We will fill this out! } Output: Hi I’m Meghan and I am 28 years old
  • 31. Putting it together fun displayIntroduction() { val name : String = "Meghan" val age : Int = 28 println("Hi I'm $name and I am $age years old") }
  • 32. Putting it together fun main() { displayIntroduction() } fun displayIntroduction() { val name : String = "Meghan" val age : Int = 28 println("Hi I'm $name and I am $age years old") } Output: Hi I’m Meghan and I am 28 years old
  • 33. This work is licensed under the Apache 2.0 License Returning in a function We can return an output from a function as per its defined output datatype. fun displayIntroduction() : String { return “HelloWorld”; }
  • 34. Parameters of a function We can pass extra information into a function via parameters which are declared between the parentheses. fun add(n1 : Int, n2 : Int) { return n1 + n2 }
  • 35. Parameters of a function These parameters can also have default values. fun add(n1 : Int = 0, n2 : Int = 0) { return n1 + n2 }
  • 36. Arguments of a function While calling a function in another function, the values we pass to the parameters defined are known as Arguments. fun main() { var a : Int = 2 var b : Int = 3 println(add(a, b)) }
  • 37. Work on Unit 1, Pathway 1 Have a Question? Just ask
  • 38. What’s coming next: A live coding session in which you are going to build an exciting application: Budget Tracker
  • 39. Share what you’ve learned using .#ComposeCamp on social media For a chance to be featured by Android, submit your tips on learning Compose to goo.gle/compose-tips
  • 40. See you at the next Compose Camp Session! Optional resources to check out: ● ● ● ● ● ● ● Official Android Developers Site: developer.android.com Official Android Developers Blog (for announcements) Android Developers Medium Blog (for more technical articles) Android Developers YouTube channel Follow @AndroidDev on Twitter Follow @AndroidDev on LinkedIn Subscribe to the Android Developer Newsletter