Fireship · @fireship
Kotlin in 100 Seconds
Uploaded November 5, 2021 · Length 2:22
Summary
kotlin basics: statically typed language with concise syntax and features like type inference and null safety.
- kotlin language
- kotlin syntax
- kotlin features
- java alternative
- android development
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
kotlin a statically typed multi-paradigm
- 0:02
language designed quite simply as a
- 0:04
better alternative to java like java it
- 0:07
compiles to bytecode that runs on the
- 0:09
java virtual machine but kotlin provides
- 0:11
a more concise syntax and language
- 0:13
features loved by modern developers like
- 0:15
type inference functional patterns null
- 0:18
safety and more it was announced in 2011
- 0:20
by jetbrains with the first stable
- 0:22
release coming in 2016. it's named after
- 0:25
kotlin island in russia and it just got
- 0:26
a mascot in october 2021 but it still
- 0:29
doesn't have a name yet one of its key
- 0:31
features is that it can interop with
- 0:32
existing java code which means
- 0:34
developers can gradually adopt it
- 0:36
without throwing all of their code in
- 0:37
the garbage in addition to jvm kotlin
- 0:39
can also compile to native code and
- 0:42
javascript opening the door to
- 0:43
multi-platform apps it's been most
- 0:45
influential in the android development
- 0:47
community and as of 2019 google named it
- 0:49
the preferred language for android
- 0:51
development over java one of its killer
- 0:53
features is co-routines which provides a
- 0:55
simplified way to write asynchronous
- 0:57
non-blocking code a common requirement
- 0:59
for mobile developers to get started
- 1:01
create a file ending in.kt most kotlin
- 1:04
developers use something like intellij
- 1:06
idea which is an ide brought to you by
- 1:08
the same company that invented the
- 1:10
language inside the file use the fun
- 1:12
keyword to define a main function this
- 1:14
is where your code will start executing
- 1:16
and that syntax is a lot more fun to
- 1:17
write than public static void main
- 1:19
string args declare a variable with the
- 1:21
var keyword assign a value and its type
- 1:24
will be inferred automatically or you
- 1:25
can add a colon after the variable name
- 1:27
with an explicit type a variable can't
- 1:29
be null unless you explicitly allow it
- 1:31
with a question mark on the type now use
- 1:33
printline to log the variable to the
- 1:35
standard output notice how semicolons
- 1:37
are optional which means that line
- 1:39
breaks are significant kotlin supports
- 1:40
familiar object-oriented patterns but
- 1:42
can do special functional things that
- 1:44
java cannot like modify the behavior of
- 1:46
a class without inheritance using
- 1:48
extension functions functions are first
- 1:50
class objects which means they can be
- 1:52
stored as variables passed as arguments
- 1:54
or used anonymously with lambdas kotlin
- 1:56
also reduces boilerplate with things
- 1:58
like data classes so you don't have to


