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
170
Programacion
camachoyury
0
93
Kotlin for Android Developers
camachoyury
0
130
Android Wear
camachoyury
0
22
Google Glass KickStart
camachoyury
0
33
Other Decks in Technology
See All in Technology
開発生産性大幅アップ!Postman VS Code拡張機能
nagix
2
380
On Your Data を超えていく!
hirotomotaguchi
2
680
GrafanaMeetup_AmazonManagedGrafanaのアクセス制御機能とマルチテナント環境下でのアクセス制御について
daitak
0
200
ここが嬉しいABAC ここが辛いよABAC #再解説+補足編
masahirokawahara
1
270
IaCジェネレーターとBedrockで詳細設計書を生成してみた
tsukasa_ishimaru
1
140
MLOpsの「壁」を乗り越える、LINEヤフーの Data Quality as Code
lycorptech_jp
PRO
5
510
オーナーシップを持つ領域を明確にする
konifar
13
3.2k
require(ESM)とECMAScript仕様
uhyo
3
610
MapLibreとAmazon Location Service
dayjournal
1
150
開発パフォーマンスを最大化するための開発体制
ham0215
2
400
Kernel MemoryでAzure OpenAI Serviceとお手軽データソース連携
mitsuzono
1
250
地理空間データ可視化・解析・活用ソリューション Pacific Spatial Solutions (PSS)
pacificspatialsolutions
0
260
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
19
1.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
322
20k
Building Better People: How to give real-time feedback that sticks.
wjessup
355
18k
Embracing the Ebb and Flow
colly
80
4.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
244
20k
Large-scale JavaScript Application Architecture
addyosmani
504
110k
Practical Orchestrator
shlominoach
182
9.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
31
46k
Design by the Numbers
sachag
274
18k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Faster Mobile Websites
deanohume
299
30k
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