SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Kotlin
L → ∞
@
@selassiabdellah ngMorocco
What is Kotlin ?
An open source JVM targeted
language for JVM, Android & JS
Why JetBrains do create Kotlin?
IDEs for every language
Language that cut down the codebase
Concise language
Get ride for language issue NPE,..
Why JetBrains do create Kotlin?
IDEs for every language
Language that cut down the codebase
Concise language
Get ride for language issues NPE,..
The Kotlin Language
Single line function.
Everything is expression in K
Mark return from labels
Lambda compile down to Anonymous
class
The Kotlin Language
Auto cast/smart cast
By default vars/types can’t have a null
value
Elvis operator
The less side effect you have the more
correct your program is (immutability)
- Hadi Hariri
JavaScript support
All language features in Kotlin 1.1
Reflection for JavaScript is not available
Dynamic types (dynamic types to
interoperate with “native” JavaScript
code)
JavaScript support
Node.js and the browser Support
npm The Kotlin Standard Library is
available for use through npm)
SINGLE LINE FUNCTION
fun double(x: Int): Int = x * 2
SINGLE LINE FUNCTION
fun double(x: Int) = x * 2
Kotlin By Example @lastIndex
length - 1
lastIndex
Kotlin By Example @Nullable
/**
* Consumes the next line of text and returns it.
* Returns null if there are no more lines.
*/
function readUtf8Line() throw "Exception"
/**
* Consumes the next line of text and returns it.
* Returns null if there are no more lines.
*/
fun readUtf8Line(): String?
Kotlin By Example @Nothing
fun fail() {
throw RuntimeException("Something went wrong")
}
fun fail(): Nothing {
throw RuntimeException("Something went wrong")
}
Kotlin By Example @when
if (firstName.equals("Dad")) {
person.setTeam(programmers);
} else if (lastName.equals("Dihiansan")) {
person.setTeam(designers);
} else {
person.setTeam(others);
}
when {
firstName == "Dan" -> person.team = programmers
lastName == "Dihiansan" -> person.team = designers
else -> person.team = others
}
Kotlin By Example @when
switch (firstName) {
case "Dan": person.setTeam(programmers)
break;
case "Jay": person.setTeam(programmers)
break;
case "Jamie": person.setTeam(designers)
break;
default:
person.setTeam(others)
}
when (firstName) {
"Dan", "Jay" -> person.team = programmers
"Jamie" -> person.team = designers
else -> person.team = others
}
Kotlin By Example @let
if (message != null) {
System.out.println(message)
}
message?.let { println(it) }
Kotlin By Example @?:
if (people == null) {
people = new ArrayList();
}
return people ?: emptyArrayList()
if (people == null) {
people = new ArrayList();
}
return people ?: emptyArrayList()
Just an ε demo
Where do I begin ?
Kotlin.link — almost a complete list of links to
Kotlin projects, libraries and other resources
Kotlin Weekly — a weekly mailing list containing
latest notable news and articles
The Daily Kotlin — Daily Kotlin news and tips
QUESTIONS?
@selassiabdellah

Weitere ähnliche Inhalte

Was ist angesagt?

Kotlin presentation
Kotlin presentation Kotlin presentation
Kotlin presentation MobileAcademy
 
Introduction to Kotlin for Java developer
Introduction to Kotlin for Java developerIntroduction to Kotlin for Java developer
Introduction to Kotlin for Java developerShuhei Shogen
 
Modern Programming Languages - An overview
Modern Programming Languages - An overviewModern Programming Languages - An overview
Modern Programming Languages - An overviewAyman Mahfouz
 
Scala the-good-parts
Scala the-good-partsScala the-good-parts
Scala the-good-partsFuqiang Wang
 
Having Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaHaving Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaDILo Surabaya
 
Functional programming with Xtend
Functional programming with XtendFunctional programming with Xtend
Functional programming with XtendSven Efftinge
 
Introduction to Kotlin JVM language
Introduction to Kotlin JVM languageIntroduction to Kotlin JVM language
Introduction to Kotlin JVM languageAndrius Klimavicius
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutinesRoman Elizarov
 
Messages from Perl
Messages from PerlMessages from Perl
Messages from PerlHanae Aoki
 
Kotlin for android
Kotlin for androidKotlin for android
Kotlin for androidShady Selim
 
Kotlin & Arrow the functional way
Kotlin & Arrow the functional wayKotlin & Arrow the functional way
Kotlin & Arrow the functional wayThoughtworks
 
Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)lennartkats
 
Kotlin & arrow: the functional way
Kotlin & arrow:  the functional wayKotlin & arrow:  the functional way
Kotlin & arrow: the functional waynluaces
 
Introduction to kotlin for Java Developer
Introduction to kotlin for Java DeveloperIntroduction to kotlin for Java Developer
Introduction to kotlin for Java Developertroubledkumi
 
Xtend - better java with -less- noise
Xtend - better java with -less- noiseXtend - better java with -less- noise
Xtend - better java with -less- noiseNeeraj Bhusare
 
FregeFX - JavaFX with Frege, a Haskell for the JVM
FregeFX - JavaFX with Frege, a Haskell for the JVMFregeFX - JavaFX with Frege, a Haskell for the JVM
FregeFX - JavaFX with Frege, a Haskell for the JVMDierk König
 
Grooming with Groovy
Grooming with GroovyGrooming with Groovy
Grooming with GroovyDhaval Dalal
 
Functions, anonymous functions and the function type
Functions, anonymous functions and the function typeFunctions, anonymous functions and the function type
Functions, anonymous functions and the function typeChang John
 

Was ist angesagt? (20)

Kotlin presentation
Kotlin presentation Kotlin presentation
Kotlin presentation
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Introduction to Kotlin for Java developer
Introduction to Kotlin for Java developerIntroduction to Kotlin for Java developer
Introduction to Kotlin for Java developer
 
Modern Programming Languages - An overview
Modern Programming Languages - An overviewModern Programming Languages - An overview
Modern Programming Languages - An overview
 
Scala the-good-parts
Scala the-good-partsScala the-good-parts
Scala the-good-parts
 
Having Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaHaving Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo Surabaya
 
Functional programming with Xtend
Functional programming with XtendFunctional programming with Xtend
Functional programming with Xtend
 
Introduction to Kotlin JVM language
Introduction to Kotlin JVM languageIntroduction to Kotlin JVM language
Introduction to Kotlin JVM language
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutines
 
Messages from Perl
Messages from PerlMessages from Perl
Messages from Perl
 
Kotlin for android
Kotlin for androidKotlin for android
Kotlin for android
 
Kotlin & Arrow the functional way
Kotlin & Arrow the functional wayKotlin & Arrow the functional way
Kotlin & Arrow the functional way
 
Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Kotlin & arrow: the functional way
Kotlin & arrow:  the functional wayKotlin & arrow:  the functional way
Kotlin & arrow: the functional way
 
Introduction to kotlin for Java Developer
Introduction to kotlin for Java DeveloperIntroduction to kotlin for Java Developer
Introduction to kotlin for Java Developer
 
Xtend - better java with -less- noise
Xtend - better java with -less- noiseXtend - better java with -less- noise
Xtend - better java with -less- noise
 
FregeFX - JavaFX with Frege, a Haskell for the JVM
FregeFX - JavaFX with Frege, a Haskell for the JVMFregeFX - JavaFX with Frege, a Haskell for the JVM
FregeFX - JavaFX with Frege, a Haskell for the JVM
 
Grooming with Groovy
Grooming with GroovyGrooming with Groovy
Grooming with Groovy
 
Functions, anonymous functions and the function type
Functions, anonymous functions and the function typeFunctions, anonymous functions and the function type
Functions, anonymous functions and the function type
 

Ähnlich wie Kotlin L → ∞

Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Mohamed Nabil, MSc.
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Jimmy Schementi
 
What’s new in Kotlin?
What’s new in Kotlin?What’s new in Kotlin?
What’s new in Kotlin?Squareboat
 
A quick and fast intro to Kotlin
A quick and fast intro to Kotlin A quick and fast intro to Kotlin
A quick and fast intro to Kotlin XPeppers
 
Kotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparisonKotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparisonEd Austin
 
name name2 n
name name2 nname name2 n
name name2 ncallroom
 
name name2 n2
name name2 n2name name2 n2
name name2 n2callroom
 
name name2 n
name name2 nname name2 n
name name2 ncallroom
 
name name2 n
name name2 nname name2 n
name name2 ncallroom
 
name name2 n2.ppt
name name2 n2.pptname name2 n2.ppt
name name2 n2.pptcallroom
 
Ruby for Perl Programmers
Ruby for Perl ProgrammersRuby for Perl Programmers
Ruby for Perl Programmersamiable_indian
 

Ähnlich wie Kotlin L → ∞ (20)

Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011
 
What’s new in Kotlin?
What’s new in Kotlin?What’s new in Kotlin?
What’s new in Kotlin?
 
A quick and fast intro to Kotlin
A quick and fast intro to Kotlin A quick and fast intro to Kotlin
A quick and fast intro to Kotlin
 
Kotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparisonKotlin Language Features - A Java comparison
Kotlin Language Features - A Java comparison
 
Kotlin
KotlinKotlin
Kotlin
 
ppt7
ppt7ppt7
ppt7
 
ppt2
ppt2ppt2
ppt2
 
name name2 n
name name2 nname name2 n
name name2 n
 
name name2 n2
name name2 n2name name2 n2
name name2 n2
 
test ppt
test ppttest ppt
test ppt
 
name name2 n
name name2 nname name2 n
name name2 n
 
ppt21
ppt21ppt21
ppt21
 
name name2 n
name name2 nname name2 n
name name2 n
 
ppt17
ppt17ppt17
ppt17
 
ppt30
ppt30ppt30
ppt30
 
name name2 n2.ppt
name name2 n2.pptname name2 n2.ppt
name name2 n2.ppt
 
ppt18
ppt18ppt18
ppt18
 
Ruby for Perl Programmers
Ruby for Perl ProgrammersRuby for Perl Programmers
Ruby for Perl Programmers
 
ppt9
ppt9ppt9
ppt9
 

Kürzlich hochgeladen

%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Kürzlich hochgeladen (20)

%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

Kotlin L → ∞

  • 2.
  • 3. What is Kotlin ? An open source JVM targeted language for JVM, Android & JS
  • 4. Why JetBrains do create Kotlin? IDEs for every language Language that cut down the codebase Concise language Get ride for language issue NPE,..
  • 5.
  • 6. Why JetBrains do create Kotlin? IDEs for every language Language that cut down the codebase Concise language Get ride for language issues NPE,..
  • 7. The Kotlin Language Single line function. Everything is expression in K Mark return from labels Lambda compile down to Anonymous class
  • 8. The Kotlin Language Auto cast/smart cast By default vars/types can’t have a null value Elvis operator
  • 9. The less side effect you have the more correct your program is (immutability) - Hadi Hariri
  • 10. JavaScript support All language features in Kotlin 1.1 Reflection for JavaScript is not available Dynamic types (dynamic types to interoperate with “native” JavaScript code)
  • 11. JavaScript support Node.js and the browser Support npm The Kotlin Standard Library is available for use through npm)
  • 12. SINGLE LINE FUNCTION fun double(x: Int): Int = x * 2
  • 13. SINGLE LINE FUNCTION fun double(x: Int) = x * 2
  • 14. Kotlin By Example @lastIndex length - 1 lastIndex
  • 15. Kotlin By Example @Nullable /** * Consumes the next line of text and returns it. * Returns null if there are no more lines. */ function readUtf8Line() throw "Exception" /** * Consumes the next line of text and returns it. * Returns null if there are no more lines. */ fun readUtf8Line(): String?
  • 16. Kotlin By Example @Nothing fun fail() { throw RuntimeException("Something went wrong") } fun fail(): Nothing { throw RuntimeException("Something went wrong") }
  • 17. Kotlin By Example @when if (firstName.equals("Dad")) { person.setTeam(programmers); } else if (lastName.equals("Dihiansan")) { person.setTeam(designers); } else { person.setTeam(others); } when { firstName == "Dan" -> person.team = programmers lastName == "Dihiansan" -> person.team = designers else -> person.team = others }
  • 18. Kotlin By Example @when switch (firstName) { case "Dan": person.setTeam(programmers) break; case "Jay": person.setTeam(programmers) break; case "Jamie": person.setTeam(designers) break; default: person.setTeam(others) } when (firstName) { "Dan", "Jay" -> person.team = programmers "Jamie" -> person.team = designers else -> person.team = others }
  • 19. Kotlin By Example @let if (message != null) { System.out.println(message) } message?.let { println(it) }
  • 20. Kotlin By Example @?: if (people == null) { people = new ArrayList(); } return people ?: emptyArrayList()
  • 21. if (people == null) { people = new ArrayList(); } return people ?: emptyArrayList()
  • 22. Just an ε demo
  • 23. Where do I begin ? Kotlin.link — almost a complete list of links to Kotlin projects, libraries and other resources Kotlin Weekly — a weekly mailing list containing latest notable news and articles The Daily Kotlin — Daily Kotlin news and tips

Hinweis der Redaktion

  1. Bonjour Tous le monde A prime abord je me présente je suis Abdellah SELASSI Expert Android et développeur full stack mobile. Aujourd’hui vous allez voir le magnifique langage Kotlin développé par JetBrains et qui le langage le plus préféré dans la communauté Android ainsi qu’il est officiellement reconnu par google
  2. Voici quelque société qui utilise Kotlin
  3. C’est quoi Kotlin ? C'est un nouveau langage de programmation ciblant la plate-forme Java et JavaScript. Kotlin est un langage dont le typage est statique qui vise la lisibilité du coup il est concise, pragmatique ainsi qu’il le langage a introduit un nouveau concept et qui est parmis c’est point fort : qui est l'interopérabilité avec Java et JavaScript. Il peut être utilisé presque partout où Java & JavaScript est utilisé aujourd'hui: pour le développement côté serveur, côté client, développement Android, et bien plus encore. Kotlin fonctionne très bien avec toutes les librairies et frameworks Java et JavaScript existants. Kotlin vient de l'industrie, pas du milieu académique. Ce qui dit qu’il résout les problèmes rencontrés aujourd’hui par les programmeurs. --- Statically typed programming language for the JVM, Android and the browser Target platforms : server-side, Android, JS, anywhere Java runs
  4. Les utilisateurs de Kotlin obtiennent encore plus: la sécurité nulle imposée par le compilateur L'approche des langues modernes, y compris Kotlin, consiste à convertir (NullPointerException) des erreurs d'exécution en erreurs de compilation. Via le support de la nullabilité dans les types du système, le compilateur peut détecter de nombreuses erreurs possibles pendant la compilation et réduire la possibilité d'avoir des exceptions lancées au moment de l'exécution ---- Kotlin users get even more: compiler-enforced null safety The approach of modern languages, including Kotlin, is to convert these problems (NPE) from runtime errors into compile-time errors. By supporting nullability as part of the type system, the compiler can detect many possible errors during compilation and reduce the possibility of having exceptions thrown at runtime
  5. Les utilisateurs de Kotlin obtiennent encore plus: la sécurité nulle imposée par le compilateur L'approche des langues modernes, y compris Kotlin, consiste à convertir (NullPointerException) des erreurs d'exécution en erreurs de compilation. Via le support de la nullabilité dans les types du système, le compilateur peut détecter de nombreuses erreurs possibles pendant la compilation et réduire la possibilité d'avoir des exceptions lancées au moment de l'exécution ---- Kotlin users get even more: compiler-enforced null safety The approach of modern languages, including Kotlin, is to convert these problems (NPE) from runtime errors into compile-time errors. By supporting nullability as part of the type system, the compiler can detect many possible errors during compilation and reduce the possibility of having exceptions thrown at runtime
  6. Single line function (function with no body) -> equal’s some value -> type inference -> ignore type return Everything is expression in K -> return expression directly Mark return from labels -> useful with lambda Lambda compile down to Anonymous class (AC) -> AC has ref to it’s parent (K handle this think like Java 8)
  7. Single line function (function with no body) -> equal’s some value -> type inference -> ignore type return Lorsqu'une fonction renvoie une seule expression, les accolades peuvent être omises et le corps de la fonction deviendra après le symbole = When a function returns a single expression, the curly braces can be omitted and the body is specified after a = symbol
  8. La déclaration explicite du type de retour est facultative lorsque cela peut être déduit par le compilateur -- Explicitly declaring the return type is optional when this can be inferred by the compiler
  9. The Nothing type : This function never returns
  10. ... // execute this block if not null