Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin, The Force Awakens
Search
Yury Camacho
June 03, 2017
Technology
0
100
Kotlin, The Force Awakens
Introduction to Kotlin language, chapter I
Yury Camacho
June 03, 2017
Tweet
Share
More Decks by Yury Camacho
See All by Yury Camacho
Flutter 101
camachoyury
0
220
Programacion
camachoyury
0
110
Kotlin for Android Developers
camachoyury
0
140
Android Wear
camachoyury
0
26
Google Glass KickStart
camachoyury
0
38
Other Decks in Technology
See All in Technology
大「個人開発サービス」時代に僕たちはどう生きるか
sotarok
20
9.9k
MCPで変わる Amebaデザインシステム「Spindle」の開発
spindle
PRO
3
3.2k
Webアプリケーションにオブザーバビリティを実装するRust入門ガイド
nwiizo
7
800
「全員プロダクトマネージャー」を実現する、Cursorによる仕様検討の自動運転
applism118
21
10k
LLMを搭載したプロダクトの品質保証の模索と学び
qa
0
1k
バイブスに「型」を!Kent Beckに学ぶ、AI時代のテスト駆動開発
amixedcolor
2
540
AIのグローバルトレンド2025 #scrummikawa / global ai trend
kyonmm
PRO
1
280
現場で効くClaude Code ─ 最新動向と企業導入
takaakikakei
1
240
Agile PBL at New Grads Trainings
kawaguti
PRO
1
420
Codeful Serverless / 一人運用でもやり抜く力
_kensh
7
400
La gouvernance territoriale des données grâce à la plateforme Terreze
bluehats
0
170
Function Body Macros で、SwiftUI の View に Accessibility Identifier を自動付与する/Function Body Macros: Autogenerate accessibility identifiers for SwiftUI Views
miichan
2
180
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
810
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Making Projects Easy
brettharned
117
6.4k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Designing for humans not robots
tammielis
253
25k
BBQ
matthewcrist
89
9.8k
Being A Developer After 40
akosma
90
590k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
Site-Speed That Sticks
csswizardry
10
810
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
The Art of Programming - Codeland 2020
erikaheidi
56
13k
Transcript
Kotlin The Force Awakens @camachoyury
None
Android official support Kotlin
What is Kotlin? • JVM • Seems like Java •
Object Oriented • Functional • Less code than Java • No need Classes • Null safety
No need Classes fun main(args: Array<String>){ println("be the force with
you") }
Variables y mutability val name: String = "Kylo Ren" var
side = "Force" side = "Dark Side" name = "Kylo" //no compile!!!
Template String fun activateSable(color: String){ println("${color} Sable activate!!" ) }
“If” is so cool! var sable = true; println( if
(sable) { "Activate" }else { "Deactivated" })
Null Safety // error no compile var clone: String =
null //can not be a value of a non-null type String // could be null var clone2: String? = null clone2 = "clone" // I’m sure, clone2 is not null println( clone2!! )
Functions Extension functions
Functions • No need to be part of a class
• “fun” keyword for create a function • Default parameters • Named Parameters • Extension functions
Functions in kotlin fun sableActivated(character: Character) :Boolean { character.sable }
Default parameters class Character(name: String, sable: Boolean = false ){
val name = name; var sable = sable }
Named parameters var kylo = Character( sable = true, name
= "Kylo Ren")
Extension functions fun Character.showup(){ println(this.name) println( if (this.sable){ "Has sable"
}else "No sable" ) }
Extension functions fun String.printYourSelf(){ println(this) } "Force be with you".printYourSelf()
Infix functions infix fun Character.fight(character: Character){ println("fight beginig ${this.name} and
${character.name} ") } kylo fight rey
Clases class Character(name: String, sable:Boolean ){ val name = name;
var sable = sable }
Herencia open data class Character(var name: String, var sable:Boolean =
false ){ } class SecCharacter(name: String) : Character(name){ }
Bye bye POJO data class Character(var nombre: String, var sable:Boolean
= false ){} //function by default kylo.toString() kylo.hashCode() kylo.equals() //setters and getters by default kylo.name kylo.sable
Questions?
https://kotlinlang.org https://antonioleiva.com/ Links reference
None