こんな時どう書くの? 逆引きKotlin入門
by
Fukui Atsuko
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
͜Μͳ࣌Ͳ͏ॻ͘ͷʁ ٯҾ͖Kotlinೖ 2018/5/30 KotlinѪձ vol1 Atsuko FUKUI
Slide 2
Slide 2 text
Agenda • ࣗݾհ • ຊͷΰʔϧ • ͜Μͳ࣌Ͳ͏ॻ͘ͷʁٯҾ͖Kotlinೖ • ·ͱΊ
Slide 3
Slide 3 text
ࣗݾհ • Ҫರࢠ / Fukui Atsuko • @muumuumuumuu • Android Developer • Mercari, Inc.
Slide 4
Slide 4 text
ຊͷΰʔϧ • ؾܰʹKotlinΛॻ͖࢝ΊΒΕΔΑ͏ʹٯҾ͖ͷ ReferenceΛఏڙ͢Δ • Kotlinॳ৺ऀ͚Λఆ • Kotlin͢Ͱʹॻ͖ͳΕ͍ͯΔਓʮΘ͔Δʯ ʮKotlin͔Θ͍͍ʯͱࢥ͍ͳ͕Βฉ͍͍ͯͯԼ͞ ͍ • #love_kotlin ͷϋογϡλά͋Γ·͢Αʂ
Slide 5
Slide 5 text
͜Μͳ࣌Ͳ͏ॻ͘ͷʁ ٯҾ͖Kotlinೖ
Slide 6
Slide 6 text
มͷએݴ(1/3) • val / var म০ࢠͰม͕એݴͰ͖Δ • valfinal, var࠶ೖՄ
Slide 7
Slide 7 text
มͷએݴ(2/3) • ܕਪΛαϙʔτ • Φϓγϣφϧ • ܕͷએݴ࣌ʹ໌ࣔతʹ?Λ͚ͭͳ͍ͱnullΛ ڐ༰͠ͳ͍
Slide 8
Slide 8 text
มͷએݴ(3/3) • Ϋϥεʹଐ͢Δඞཁͳ͍(= ୈ1ڃΦϒδΣ Ϋτͱͯ͠એݴͰ͖Δ) • ఆʹconst
Slide 9
Slide 9 text
ؔͷએݴ(1/2) • funम০ࢠͰ͕ؔએݴͰ͖Δ • ҾͱΓͷࢦఆҎԼͷ௨Γ • த͕1ߦͰ͔͚Δ߹=Ͱܨ͛ͯreturnΛ লུͰ͖Δ
Slide 10
Slide 10 text
ؔͷએݴ(2/2) • σϑΥϧτҾͱ໊લ͖ҾΛαϙʔτ
Slide 11
Slide 11 text
݅ࣜ if (1/3) • Kotlinʹ͓͍ͯifࣜ(expression) • จ(statement)Ͱͳ͍ • ͭ·ΓΛฦ͢͜ͱ͕Ͱ͖Δ
Slide 12
Slide 12 text
݅ࣜ if (2/3) • ʢ೦ͳ͕Βʣࡾ߲ԋࢉࢠαϙʔτ͞Εͯ ͍ͳ͍ • ΤϧϏεԋࢉࢠ( ?: )αϙʔτ͞Ε͍ͯΔ
Slide 13
Slide 13 text
݅ࣜ if (3/3) • null νΣοΫείʔϓؔͱΦϓγϣφϧ ͷΈ߹Θ͕ͤΑ͘ΘΕΔ
Slide 14
Slide 14 text
݅ࣜ when (1/2) • if ಉ༷ʹwhenࣜ • whenͷޙΖͷ()ͷ͕ൺֱͷରʹͳΔ
Slide 15
Slide 15 text
݅ࣜ when (2/2) • whenͷޙΖͷ() ͳͯ͘OK • ൺֱରͷ͕ෳ͋Δ߹ʹศར
Slide 16
Slide 16 text
·ͱΊ
Slide 17
Slide 17 text
·ͱΊ • มͷએݴɺؔͷએݴɺ݅ࣜ • Kotlin͔Θ͍͍ʂʂ
Slide 18
Slide 18 text
͋Γ͕ͱ͏͍͟͝·ͨ͠