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 म০ࢠͰม਺͕એݴͰ͖Δ • val͸final, 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

͋Γ͕ͱ͏͍͟͝·ͨ͠