$30 off During Our Annual Pro Sale. View Details »
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
110
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
230
Programacion
camachoyury
0
110
Kotlin for Android Developers
camachoyury
0
140
Android Wear
camachoyury
0
27
Google Glass KickStart
camachoyury
0
39
Other Decks in Technology
See All in Technology
最近のLinux普段づかいWaylandデスクトップ元年
penguin2716
1
690
Ruby で作る大規模イベントネットワーク構築・運用支援システム TTDB
taketo1113
1
270
打 造 A I 驅 動 的 G i t H u b ⾃ 動 化 ⼯ 作 流 程
appleboy
0
280
Karate+Database RiderによるAPI自動テスト導入工数をCline+GitLab MCPを使って2割削減を目指す! / 20251206 Kazuki Takahashi
shift_evolve
PRO
1
710
AI 駆動開発勉強会 フロントエンド支部 #1 w/あずもば
1ftseabass
PRO
0
340
意外とあった SQL Server 関連アップデート + Database Savings Plans
stknohg
PRO
0
310
Playwright x GitHub Actionsで実現する「レビューしやすい」E2Eテストレポート
kinosuke01
0
580
AI駆動開発における設計思想 認知負荷を下げるフロントエンドアーキテクチャ/ 20251211 Teppei Hanai
shift_evolve
PRO
2
350
Challenging Hardware Contests with Zephyr and Lessons Learned
iotengineer22
0
180
ChatGPTで論⽂は読めるのか
spatial_ai_network
7
25k
Snowflakeでデータ基盤を もう一度作り直すなら / rebuilding-data-platform-with-snowflake
pei0804
4
1.4k
AWS Trainium3 をちょっと身近に感じたい
bigmuramura
1
140
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
A designer walks into a library…
pauljervisheath
210
24k
Embracing the Ebb and Flow
colly
88
4.9k
Docker and Python
trallard
47
3.7k
Faster Mobile Websites
deanohume
310
31k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
How to train your dragon (web standard)
notwaldorf
97
6.4k
Side Projects
sachag
455
43k
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