SlideShare a Scribd company logo
Memulai
Pemrograman
dengan Kotlin
#2
Ahmad Arif Faizin
Academy Content Writer
Dicoding Indonesia
x
Tips Trik Seputar Instalasi
- Pastikan menggunakan versi yang sama dengan yang ada di modul.
- Jika sudah pernah menginstall Java sebelumnya, install dulu versi yang lama.
- Invalidate cache/restart jika tidak bisa run EduTools.
- Disable antivirus seperti Avast.
- Jika errornya “Failed to launch checking”, coba hapus folder project dan ulangi
mengambil course.
- Pastikan koneksi lancar saat instalasi.
- Kode merah-merah? pastikan besar kecil spasi sama dengan di modul.
- Untuk pengguna 32 bit bisa mencoba install JDK lewat Azul.com
3.
Kotlin Fundamental
Tipe Data & Fungsi
Hello Kotlin!
// main function
fun main() {
println("Hello Kotlin!")
}
fungsi pertama ketika
program dijalankan
untuk memberi komentar
fungsi untuk mencetak teks
ke layar/console
println vs print
fun main() {
println("Kotlin, ")
print("is Awesome!")
}
/*
output:
Kotlin,
is Awesome
*/
fun main() {
print("Kotlin, ")
print("is Awesome!")
}
/*
output:
Kotlin, is Awesome
*/
Contoh lain
fun main() {
val name = "Arif"
print("Hello my name is ")
println(name)
print(if (true) "Always true" else "Always false")
}
/*
output:
Hello my name is Arif
Always true
*/
cetak teks ke layar
untuk membuat variabel dengan tipe data string
untuk membuat
percabangan
cetak teks ke layar dan
membuat baris baru
Cara Menulis Variabel
var namaVariabel: TipeData = isi(value)
Contoh :
var company: String = "Dicoding"
atau bisa disingkat
var company = "Dicoding"
tipe data akan
menyesuaikan dengan
isinya
var vs val
Bisa diubah nilainya
(mutable)
var company = "Dicoding"
company = "Dicoding Academy"
Tidak bisa diubah nilainya
(immutable)
val company = "Dicoding"
company = "Dicoding Academy"
//Val cannot be reassigned
Tipe Data
Char hanya satu karakter ‘A’
String kumpulan dari banyak karakter (teks) “Kotlin”
Array menyimpan banyak objek arrayOf(“Aku”, “Kamu”, “Dia”)
Numbers angka 7
Boolean hanya memiliki 2 nilai true/false
Char
Contoh :
val character: Char = 'A'
Contoh salah
val character: Char = 'ABC'
// Incorrect character literal
Char
Operator increment & decrement
fun main() {
var vocal = 'A'
println("Vocal " + vocal++)
println("Vocal " + vocal--)
println("Vocal " + vocal)
}
/*
output:
Vocal A
Vocal B
Vocal A
*/
String
Memasukkan variabel ke dalam String
Contoh :
fun main() {
val text = "Kotlin"
val firstChar = text[0]
print("First character of" + text + " is " + firstChar)
}
print("First character of $text is $firstChar") string template
String
Membuat pengecualian(escaped) di dalam String
Contoh :
val statement = "Kotlin is "Awesome!""
String
Membuat Raw String
Contoh :
fun main() {
val line = """
Line 1
Line 2
Line 3
Line 4
""".trimIndent()
print(line)
}
/*
output:
Line 1
Line 2
Line 3
Line 4
*/
Array
indeks dimulai dari 0
fun main() {
val intArray = intArrayOf(1, 3, 5, 7) // [1, 3, 5, 7]
intArray[2] = 11 // [1, 3, 11, 7]
print(intArray[2])
}
/*
Output: 11
*/
1 3 5 7
ke-0 ke-1 ke-2 ke-3
Boolean
Numbers
Int (32 bit) nilai angka yang umum digunakan val intNumbers = 100
Long (64 bit) nilai angka yang besar val longNumbers = 100L
Short (16 bit) nilai angka yang kecil val shortNumber: Short = 10
Byte (8 bit) nilai angka yang sangat kecil val byteNumber = 0b11010010
Double (64 bit) nilai angka pecahan val doubleNumbers = 1.3
Functions
tanpa nilai kembalian
fun main() {
setUser("Arif", 17)
}
fun setUser(name: String, age: Int){
println("Your name is $name, and you $age years old")
}
parameter yang dikirimkan
ke dalam fungsi
untuk membuat fungsi
Functions
dengan nilai kembalian
fun main() {
val user = setUser("Arif", 17)
println(user)
}
fun setUser(name: String, age: Int): String {
return "Your name is $name, and you $age years old"
}
untuk membuat nilai
kembalian
tipe data nilai yang
dikembalikan
fun setUser(name: String, age: Int) = "Your name is $name, and you $age years old"
If Expressions
percabangan berdasarkan kondisi
val openHours = 7
val now = 20
if (now > openHours){
println("office already open")
}
val openHours = 7
val now = 20
val office: String
if (now > openHours) {
office = "Office already open"
} else {
office = "Office is closed"
}
print(office)
val openHours = 7
val now = 7
val office: String
office = if (now > 7) {
"Office already open"
} else if (now == openHours){
"Wait a minute, office will be open"
} else {
"Office is closed"
}
print(office)
Nullable Types
Contoh:
val text: String? = null
Contoh salah:
val text: String = null
// compile time error
Safe Call Operator ?.
memanggil nullable dengan aman
val text: String? = null
text?.length
val text: String? = null
val textLength = text?.length ?: 7
Elvis Operator ?:
nilai default jika objek bernilai null
Kerjakan Latihan
4.
Control Flow
Percabangan & Perulangan
When Expression
Percabangan selain If Else
fun main() {
val value = 7
val stringOfValue = when (value) {
6 -> "value is 6"
7 -> "value is 7"
8 -> "value is 8"
else -> "value cannot be reached"
}
println(stringOfValue)
}
/*
output : value is 7
*/
When Expression
val anyType : Any = 100L
when(anyType){
is Long -> println("the value has a Long type")
is String -> println("the value has a String type")
else -> println("undefined")
}
val value = 27
val ranges = 10..50
when(value){
in ranges -> println("value is in the range")
!in ranges -> println("value is outside the range")
else -> println("value undefined")
}
val x = 11
when (x) {
10, 11 -> print("the value between 10 and 11")
11, 12 -> print("the value between 11 and 12")
}
val x = 10
when (x) {
5 + 5 -> print("the value is 10")
10 + 10 -> print("the value is 20")
}
Enumeration
fun main() {
val color: Color = Color.GREEN
when(color){
Color.RED -> print("Color is Red")
Color.BLUE -> print("Color is Blue")
Color.GREEN -> print("Color is Green")
}
}
enum class Color(val value: Int) {
RED(0xFF0000),
GREEN(0x00FF00),
BLUE(0x0000FF)
}
//output : Color is Green
While
Perulangan
fun main() {
var counter = 1
while (counter <= 5){
println("Hello, World!")
counter++
}
}
fun main() {
println("Hello World")
println("Hello World")
println("Hello World")
println("Hello World")
println("Hello World")
}
=
fun main() {
var counter = 1
while (counter <= 7){
println("Hello, World!")
counter++
}
}
cek dulu
baru jalankan
While vs Do While
fun main() {
var counter = 1
do {
println("Hello, World!")
counter++
} while (counter <= 7)
}
jalankan dulu
baru cek
Hati - Hati dengan infinite loop
Karena kondisi tidak terpenuhi
var value = 'A'
do {
print(value)
} while (value <= 'Z')
var i = 3
while (i > 3) {
println(i)
i--
}
val rangeInt = 1.rangeTo(10)
=
val rangeInt = 1..10
=
val rangeInt = 1 until 10
dari bawah
ke atas
rangeTo vs downTo
val downInt = 10.downTo(1)
dari atas ke bawah
For Loop
Perulangan dengan counter otomatis
fun main() {
val ranges = 1..5
for (i in ranges){
println("value is $i!")
}
}
fun main() {
var counter = 1
while (counter <= 5){
println("value is $counter!")
counter++
}
}
=
For Each
Perulangan dengan counter otomatis
fun main() {
val ranges = 1..5
ranges.forEach{
println("value is $i!")
}
}
fun main() {
val ranges = 1..5
for (i in ranges){
println("value is $i!")
}
}
=
Break & Continue
Contoh program deteksi angka ganjil sampai angka 10
fun main() {
val listNumber = 1.rangeTo(50)
for (number in listNumber) {
if (number % 2 == 0) continue
if (number > 10) break
println("$number adalah bilangan ganjil")
}
}
* % adalah modulus / sisa pembagian
misal 10 % 2 == 0, 11 % 2 = 1 , 9 % 6 = 3
/*
output:
1 adalah bilangan ganjil
3 adalah bilangan ganjil
5 adalah bilangan ganjil
7 adalah bilangan ganjil
9 adalah bilangan ganjil
*/
Lanjutkan Latihan
&
Terus Belajar!
OUR LIFE SHOULD BE JUST LIKE
MODULUS. DOESN’T MATTER WHAT VALUE
IS ENTERED, IT’S RESULT ALWAYS
POSITIVE. AND SO SHOULD BE OUR LIFE
IN EVERY SITUATION
- Pranay Neve
’’
’’
You can find me at:
● Google : Ahmad Arif Faizin
● Discord : @arifaizin
Thanks!
Any questions?

More Related Content

What's hot

Modul belajar java I/O (Input/Ouptut)
Modul belajar java I/O (Input/Ouptut)Modul belajar java I/O (Input/Ouptut)
Modul belajar java I/O (Input/Ouptut)
stephan EL'wiin Shaarawy
 
Modul Praktikum Pemrograman Berorientasi Objek (Chap.1-6)
Modul Praktikum Pemrograman Berorientasi Objek (Chap.1-6)Modul Praktikum Pemrograman Berorientasi Objek (Chap.1-6)
Modul Praktikum Pemrograman Berorientasi Objek (Chap.1-6)
Debby Ummul
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
Oon Arfiandwi
 
7. Queue (Struktur Data)
7. Queue (Struktur Data)7. Queue (Struktur Data)
7. Queue (Struktur Data)
Kelinci Coklat
 
#1 PENGENALAN PYTHON
#1 PENGENALAN PYTHON#1 PENGENALAN PYTHON
#1 PENGENALAN PYTHON
Rachmat Wahid Saleh Insani
 
6 lanjutan perulangan
6 lanjutan perulangan6 lanjutan perulangan
6 lanjutan perulangan
Simon Patabang
 
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHERTEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
Rivalri Kristianto Hondro
 
Materi : Struktur Data (1 Pengantar)
Materi : Struktur Data (1 Pengantar)Materi : Struktur Data (1 Pengantar)
Materi : Struktur Data (1 Pengantar)
eka pandu cynthia
 
Function dalam PHP
Function dalam PHPFunction dalam PHP
Function dalam PHP
I Gede Iwan Sudipa
 
Linked List dalam Struktur Data
Linked List dalam Struktur DataLinked List dalam Struktur Data
Linked List dalam Struktur Data
Fajar Sany
 
Data Array
Data ArrayData Array
Data Array
Simon Patabang
 
Array searching sorting_pert_11,12,13,14,15
Array searching sorting_pert_11,12,13,14,15Array searching sorting_pert_11,12,13,14,15
Array searching sorting_pert_11,12,13,14,15doudomblogspot
 
2. Array of Record (Struktur Data)
2. Array of Record (Struktur Data)2. Array of Record (Struktur Data)
2. Array of Record (Struktur Data)
Kelinci Coklat
 
Laporan Praktikum Algoritma
Laporan Praktikum AlgoritmaLaporan Praktikum Algoritma
Laporan Praktikum Algoritma
EnvaPya
 
CRUD pada Android Studio menggunakan MySQL
CRUD pada Android Studio menggunakan MySQLCRUD pada Android Studio menggunakan MySQL
CRUD pada Android Studio menggunakan MySQL
Lusiana Diyan
 
SE - Chapter 8 Strategi Pengujian Perangkat Lunak
SE - Chapter 8 Strategi Pengujian Perangkat LunakSE - Chapter 8 Strategi Pengujian Perangkat Lunak
SE - Chapter 8 Strategi Pengujian Perangkat Lunak
Riza Nurman
 
Makalah prosedur dan fungsi
Makalah prosedur dan fungsiMakalah prosedur dan fungsi
Makalah prosedur dan fungsi
Dwi Andriyani
 
UML Aplikasi Rental Mobil
UML Aplikasi Rental MobilUML Aplikasi Rental Mobil
UML Aplikasi Rental Mobil
Dwi Mardianti
 

What's hot (20)

Modul belajar java I/O (Input/Ouptut)
Modul belajar java I/O (Input/Ouptut)Modul belajar java I/O (Input/Ouptut)
Modul belajar java I/O (Input/Ouptut)
 
Modul Praktikum Pemrograman Berorientasi Objek (Chap.1-6)
Modul Praktikum Pemrograman Berorientasi Objek (Chap.1-6)Modul Praktikum Pemrograman Berorientasi Objek (Chap.1-6)
Modul Praktikum Pemrograman Berorientasi Objek (Chap.1-6)
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
7. Queue (Struktur Data)
7. Queue (Struktur Data)7. Queue (Struktur Data)
7. Queue (Struktur Data)
 
#1 PENGENALAN PYTHON
#1 PENGENALAN PYTHON#1 PENGENALAN PYTHON
#1 PENGENALAN PYTHON
 
Materi 6. perulangan
Materi 6. perulanganMateri 6. perulangan
Materi 6. perulangan
 
6 lanjutan perulangan
6 lanjutan perulangan6 lanjutan perulangan
6 lanjutan perulangan
 
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHERTEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
 
Materi 7. array
Materi 7. arrayMateri 7. array
Materi 7. array
 
Materi : Struktur Data (1 Pengantar)
Materi : Struktur Data (1 Pengantar)Materi : Struktur Data (1 Pengantar)
Materi : Struktur Data (1 Pengantar)
 
Function dalam PHP
Function dalam PHPFunction dalam PHP
Function dalam PHP
 
Linked List dalam Struktur Data
Linked List dalam Struktur DataLinked List dalam Struktur Data
Linked List dalam Struktur Data
 
Data Array
Data ArrayData Array
Data Array
 
Array searching sorting_pert_11,12,13,14,15
Array searching sorting_pert_11,12,13,14,15Array searching sorting_pert_11,12,13,14,15
Array searching sorting_pert_11,12,13,14,15
 
2. Array of Record (Struktur Data)
2. Array of Record (Struktur Data)2. Array of Record (Struktur Data)
2. Array of Record (Struktur Data)
 
Laporan Praktikum Algoritma
Laporan Praktikum AlgoritmaLaporan Praktikum Algoritma
Laporan Praktikum Algoritma
 
CRUD pada Android Studio menggunakan MySQL
CRUD pada Android Studio menggunakan MySQLCRUD pada Android Studio menggunakan MySQL
CRUD pada Android Studio menggunakan MySQL
 
SE - Chapter 8 Strategi Pengujian Perangkat Lunak
SE - Chapter 8 Strategi Pengujian Perangkat LunakSE - Chapter 8 Strategi Pengujian Perangkat Lunak
SE - Chapter 8 Strategi Pengujian Perangkat Lunak
 
Makalah prosedur dan fungsi
Makalah prosedur dan fungsiMakalah prosedur dan fungsi
Makalah prosedur dan fungsi
 
UML Aplikasi Rental Mobil
UML Aplikasi Rental MobilUML Aplikasi Rental Mobil
UML Aplikasi Rental Mobil
 

Similar to Dts x dicoding #2 memulai pemrograman kotlin

01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx
IvanZawPhyo
 
Introduction to Kotlin.pptx
Introduction to Kotlin.pptxIntroduction to Kotlin.pptx
Introduction to Kotlin.pptx
AzharFauzan9
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
Adam Dudczak
 
InterConnect: Server Side Swift for Java Developers
InterConnect:  Server Side Swift for Java DevelopersInterConnect:  Server Side Swift for Java Developers
InterConnect: Server Side Swift for Java Developers
Chris Bailey
 
C Sharp Jn (3)
C Sharp Jn (3)C Sharp Jn (3)
C Sharp Jn (3)jahanullah
 
Swift Study #7
Swift Study #7Swift Study #7
Swift Study #7
chanju Jeon
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fu
climatewarrior
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Lorenzo Dematté
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
yap_raiza
 
Kotlin
KotlinKotlin
Introduction to Go for Java Programmers
Introduction to Go for Java ProgrammersIntroduction to Go for Java Programmers
Introduction to Go for Java Programmers
Kalpa Pathum Welivitigoda
 
C++ course start
C++ course startC++ course start
C++ course startNet3lem
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
Geeks Anonymes
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
Pavlo Baron
 
The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181
Mahmoud Samir Fayed
 
Something about Golang
Something about GolangSomething about Golang
Something about Golang
Anton Arhipov
 
Loops
LoopsLoops
Loops
Kamran
 
Python
PythonPython
Python
대갑 김
 
The Ring programming language version 1.5.1 book - Part 22 of 180
The Ring programming language version 1.5.1 book - Part 22 of 180The Ring programming language version 1.5.1 book - Part 22 of 180
The Ring programming language version 1.5.1 book - Part 22 of 180
Mahmoud Samir Fayed
 

Similar to Dts x dicoding #2 memulai pemrograman kotlin (20)

01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx
 
Introduction to Kotlin.pptx
Introduction to Kotlin.pptxIntroduction to Kotlin.pptx
Introduction to Kotlin.pptx
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
InterConnect: Server Side Swift for Java Developers
InterConnect:  Server Side Swift for Java DevelopersInterConnect:  Server Side Swift for Java Developers
InterConnect: Server Side Swift for Java Developers
 
C Sharp Jn (3)
C Sharp Jn (3)C Sharp Jn (3)
C Sharp Jn (3)
 
Swift Study #7
Swift Study #7Swift Study #7
Swift Study #7
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fu
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
 
Kotlin
KotlinKotlin
Kotlin
 
Introduction to Go for Java Programmers
Introduction to Go for Java ProgrammersIntroduction to Go for Java Programmers
Introduction to Go for Java Programmers
 
C++ course start
C++ course startC++ course start
C++ course start
 
Geeks Anonymes - Le langage Go
Geeks Anonymes - Le langage GoGeeks Anonymes - Le langage Go
Geeks Anonymes - Le langage Go
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181The Ring programming language version 1.5.2 book - Part 14 of 181
The Ring programming language version 1.5.2 book - Part 14 of 181
 
Something about Golang
Something about GolangSomething about Golang
Something about Golang
 
Ruby
RubyRuby
Ruby
 
Loops
LoopsLoops
Loops
 
Python
PythonPython
Python
 
The Ring programming language version 1.5.1 book - Part 22 of 180
The Ring programming language version 1.5.1 book - Part 22 of 180The Ring programming language version 1.5.1 book - Part 22 of 180
The Ring programming language version 1.5.1 book - Part 22 of 180
 

More from Ahmad Arif Faizin

Guideline Submission GitHub BFAA Dicoding
Guideline Submission GitHub BFAA DicodingGuideline Submission GitHub BFAA Dicoding
Guideline Submission GitHub BFAA Dicoding
Ahmad Arif Faizin
 
Proker Departemen Dakwah dan Syiar 2013.pptx
Proker Departemen Dakwah dan Syiar 2013.pptxProker Departemen Dakwah dan Syiar 2013.pptx
Proker Departemen Dakwah dan Syiar 2013.pptx
Ahmad Arif Faizin
 
DKM_2013_BISMILLAH.pptx
DKM_2013_BISMILLAH.pptxDKM_2013_BISMILLAH.pptx
DKM_2013_BISMILLAH.pptx
Ahmad Arif Faizin
 
Proker bendahara al muhandis 2013.ppt
Proker bendahara al muhandis 2013.pptProker bendahara al muhandis 2013.ppt
Proker bendahara al muhandis 2013.ppt
Ahmad Arif Faizin
 
PPT raker EKONOMI 2013.pptx
PPT raker EKONOMI 2013.pptxPPT raker EKONOMI 2013.pptx
PPT raker EKONOMI 2013.pptx
Ahmad Arif Faizin
 
Program Kerja Kaderisasi Al Muhandis 2013
Program Kerja Kaderisasi Al Muhandis 2013Program Kerja Kaderisasi Al Muhandis 2013
Program Kerja Kaderisasi Al Muhandis 2013
Ahmad Arif Faizin
 
Departemen Mentoring.pptx
Departemen Mentoring.pptxDepartemen Mentoring.pptx
Departemen Mentoring.pptx
Ahmad Arif Faizin
 
ANNISAA' 2013.pptx
ANNISAA' 2013.pptxANNISAA' 2013.pptx
ANNISAA' 2013.pptx
Ahmad Arif Faizin
 
PPT KKN PEDURUNGAN 2016.pptx
PPT KKN PEDURUNGAN 2016.pptxPPT KKN PEDURUNGAN 2016.pptx
PPT KKN PEDURUNGAN 2016.pptx
Ahmad Arif Faizin
 
Absis UNBK.pptx
Absis UNBK.pptxAbsis UNBK.pptx
Absis UNBK.pptx
Ahmad Arif Faizin
 
Dsc how google programs make great developer
Dsc how google programs make great developerDsc how google programs make great developer
Dsc how google programs make great developer
Ahmad Arif Faizin
 
First Gathering Sandec
First Gathering SandecFirst Gathering Sandec
First Gathering Sandec
Ahmad Arif Faizin
 
Mockup Android Application Template Library
Mockup Android Application Template LibraryMockup Android Application Template Library
Mockup Android Application Template Library
Ahmad Arif Faizin
 
Mockup Android Application : Go bon
Mockup Android Application : Go bonMockup Android Application : Go bon
Mockup Android Application : Go bon
Ahmad Arif Faizin
 
Lomba Sayembara Logo
Lomba Sayembara LogoLomba Sayembara Logo
Lomba Sayembara Logo
Ahmad Arif Faizin
 
Template Video Invitation Walimatul Ursy
Template Video Invitation Walimatul UrsyTemplate Video Invitation Walimatul Ursy
Template Video Invitation Walimatul Ursy
Ahmad Arif Faizin
 
Training Android Wonderkoding
Training Android WonderkodingTraining Android Wonderkoding
Training Android Wonderkoding
Ahmad Arif Faizin
 
The Best Way to Become an Android Developer Expert with Android Jetpack
The Best Way to Become an Android Developer Expert  with Android JetpackThe Best Way to Become an Android Developer Expert  with Android Jetpack
The Best Way to Become an Android Developer Expert with Android Jetpack
Ahmad Arif Faizin
 
Mengapa Perlu Belajar Coding?
Mengapa Perlu Belajar Coding?Mengapa Perlu Belajar Coding?
Mengapa Perlu Belajar Coding?
Ahmad Arif Faizin
 
PPT Seminar TA Augmented Reality
PPT Seminar TA Augmented RealityPPT Seminar TA Augmented Reality
PPT Seminar TA Augmented Reality
Ahmad Arif Faizin
 

More from Ahmad Arif Faizin (20)

Guideline Submission GitHub BFAA Dicoding
Guideline Submission GitHub BFAA DicodingGuideline Submission GitHub BFAA Dicoding
Guideline Submission GitHub BFAA Dicoding
 
Proker Departemen Dakwah dan Syiar 2013.pptx
Proker Departemen Dakwah dan Syiar 2013.pptxProker Departemen Dakwah dan Syiar 2013.pptx
Proker Departemen Dakwah dan Syiar 2013.pptx
 
DKM_2013_BISMILLAH.pptx
DKM_2013_BISMILLAH.pptxDKM_2013_BISMILLAH.pptx
DKM_2013_BISMILLAH.pptx
 
Proker bendahara al muhandis 2013.ppt
Proker bendahara al muhandis 2013.pptProker bendahara al muhandis 2013.ppt
Proker bendahara al muhandis 2013.ppt
 
PPT raker EKONOMI 2013.pptx
PPT raker EKONOMI 2013.pptxPPT raker EKONOMI 2013.pptx
PPT raker EKONOMI 2013.pptx
 
Program Kerja Kaderisasi Al Muhandis 2013
Program Kerja Kaderisasi Al Muhandis 2013Program Kerja Kaderisasi Al Muhandis 2013
Program Kerja Kaderisasi Al Muhandis 2013
 
Departemen Mentoring.pptx
Departemen Mentoring.pptxDepartemen Mentoring.pptx
Departemen Mentoring.pptx
 
ANNISAA' 2013.pptx
ANNISAA' 2013.pptxANNISAA' 2013.pptx
ANNISAA' 2013.pptx
 
PPT KKN PEDURUNGAN 2016.pptx
PPT KKN PEDURUNGAN 2016.pptxPPT KKN PEDURUNGAN 2016.pptx
PPT KKN PEDURUNGAN 2016.pptx
 
Absis UNBK.pptx
Absis UNBK.pptxAbsis UNBK.pptx
Absis UNBK.pptx
 
Dsc how google programs make great developer
Dsc how google programs make great developerDsc how google programs make great developer
Dsc how google programs make great developer
 
First Gathering Sandec
First Gathering SandecFirst Gathering Sandec
First Gathering Sandec
 
Mockup Android Application Template Library
Mockup Android Application Template LibraryMockup Android Application Template Library
Mockup Android Application Template Library
 
Mockup Android Application : Go bon
Mockup Android Application : Go bonMockup Android Application : Go bon
Mockup Android Application : Go bon
 
Lomba Sayembara Logo
Lomba Sayembara LogoLomba Sayembara Logo
Lomba Sayembara Logo
 
Template Video Invitation Walimatul Ursy
Template Video Invitation Walimatul UrsyTemplate Video Invitation Walimatul Ursy
Template Video Invitation Walimatul Ursy
 
Training Android Wonderkoding
Training Android WonderkodingTraining Android Wonderkoding
Training Android Wonderkoding
 
The Best Way to Become an Android Developer Expert with Android Jetpack
The Best Way to Become an Android Developer Expert  with Android JetpackThe Best Way to Become an Android Developer Expert  with Android Jetpack
The Best Way to Become an Android Developer Expert with Android Jetpack
 
Mengapa Perlu Belajar Coding?
Mengapa Perlu Belajar Coding?Mengapa Perlu Belajar Coding?
Mengapa Perlu Belajar Coding?
 
PPT Seminar TA Augmented Reality
PPT Seminar TA Augmented RealityPPT Seminar TA Augmented Reality
PPT Seminar TA Augmented Reality
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 

Recently uploaded (20)

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 

Dts x dicoding #2 memulai pemrograman kotlin

  • 1. Memulai Pemrograman dengan Kotlin #2 Ahmad Arif Faizin Academy Content Writer Dicoding Indonesia x
  • 2. Tips Trik Seputar Instalasi - Pastikan menggunakan versi yang sama dengan yang ada di modul. - Jika sudah pernah menginstall Java sebelumnya, install dulu versi yang lama. - Invalidate cache/restart jika tidak bisa run EduTools. - Disable antivirus seperti Avast. - Jika errornya “Failed to launch checking”, coba hapus folder project dan ulangi mengambil course. - Pastikan koneksi lancar saat instalasi. - Kode merah-merah? pastikan besar kecil spasi sama dengan di modul. - Untuk pengguna 32 bit bisa mencoba install JDK lewat Azul.com
  • 3.
  • 5. Hello Kotlin! // main function fun main() { println("Hello Kotlin!") } fungsi pertama ketika program dijalankan untuk memberi komentar fungsi untuk mencetak teks ke layar/console
  • 6. println vs print fun main() { println("Kotlin, ") print("is Awesome!") } /* output: Kotlin, is Awesome */ fun main() { print("Kotlin, ") print("is Awesome!") } /* output: Kotlin, is Awesome */
  • 7. Contoh lain fun main() { val name = "Arif" print("Hello my name is ") println(name) print(if (true) "Always true" else "Always false") } /* output: Hello my name is Arif Always true */ cetak teks ke layar untuk membuat variabel dengan tipe data string untuk membuat percabangan cetak teks ke layar dan membuat baris baru
  • 8. Cara Menulis Variabel var namaVariabel: TipeData = isi(value) Contoh : var company: String = "Dicoding" atau bisa disingkat var company = "Dicoding" tipe data akan menyesuaikan dengan isinya
  • 9. var vs val Bisa diubah nilainya (mutable) var company = "Dicoding" company = "Dicoding Academy" Tidak bisa diubah nilainya (immutable) val company = "Dicoding" company = "Dicoding Academy" //Val cannot be reassigned
  • 10. Tipe Data Char hanya satu karakter ‘A’ String kumpulan dari banyak karakter (teks) “Kotlin” Array menyimpan banyak objek arrayOf(“Aku”, “Kamu”, “Dia”) Numbers angka 7 Boolean hanya memiliki 2 nilai true/false
  • 11. Char Contoh : val character: Char = 'A' Contoh salah val character: Char = 'ABC' // Incorrect character literal
  • 12. Char Operator increment & decrement fun main() { var vocal = 'A' println("Vocal " + vocal++) println("Vocal " + vocal--) println("Vocal " + vocal) } /* output: Vocal A Vocal B Vocal A */
  • 13. String Memasukkan variabel ke dalam String Contoh : fun main() { val text = "Kotlin" val firstChar = text[0] print("First character of" + text + " is " + firstChar) } print("First character of $text is $firstChar") string template
  • 14. String Membuat pengecualian(escaped) di dalam String Contoh : val statement = "Kotlin is "Awesome!""
  • 15. String Membuat Raw String Contoh : fun main() { val line = """ Line 1 Line 2 Line 3 Line 4 """.trimIndent() print(line) } /* output: Line 1 Line 2 Line 3 Line 4 */
  • 16. Array indeks dimulai dari 0 fun main() { val intArray = intArrayOf(1, 3, 5, 7) // [1, 3, 5, 7] intArray[2] = 11 // [1, 3, 11, 7] print(intArray[2]) } /* Output: 11 */ 1 3 5 7 ke-0 ke-1 ke-2 ke-3
  • 18. Numbers Int (32 bit) nilai angka yang umum digunakan val intNumbers = 100 Long (64 bit) nilai angka yang besar val longNumbers = 100L Short (16 bit) nilai angka yang kecil val shortNumber: Short = 10 Byte (8 bit) nilai angka yang sangat kecil val byteNumber = 0b11010010 Double (64 bit) nilai angka pecahan val doubleNumbers = 1.3
  • 19. Functions tanpa nilai kembalian fun main() { setUser("Arif", 17) } fun setUser(name: String, age: Int){ println("Your name is $name, and you $age years old") } parameter yang dikirimkan ke dalam fungsi untuk membuat fungsi
  • 20. Functions dengan nilai kembalian fun main() { val user = setUser("Arif", 17) println(user) } fun setUser(name: String, age: Int): String { return "Your name is $name, and you $age years old" } untuk membuat nilai kembalian tipe data nilai yang dikembalikan fun setUser(name: String, age: Int) = "Your name is $name, and you $age years old"
  • 21. If Expressions percabangan berdasarkan kondisi val openHours = 7 val now = 20 if (now > openHours){ println("office already open") } val openHours = 7 val now = 20 val office: String if (now > openHours) { office = "Office already open" } else { office = "Office is closed" } print(office) val openHours = 7 val now = 7 val office: String office = if (now > 7) { "Office already open" } else if (now == openHours){ "Wait a minute, office will be open" } else { "Office is closed" } print(office)
  • 22. Nullable Types Contoh: val text: String? = null Contoh salah: val text: String = null // compile time error
  • 23. Safe Call Operator ?. memanggil nullable dengan aman val text: String? = null text?.length val text: String? = null val textLength = text?.length ?: 7 Elvis Operator ?: nilai default jika objek bernilai null
  • 26. When Expression Percabangan selain If Else fun main() { val value = 7 val stringOfValue = when (value) { 6 -> "value is 6" 7 -> "value is 7" 8 -> "value is 8" else -> "value cannot be reached" } println(stringOfValue) } /* output : value is 7 */
  • 27. When Expression val anyType : Any = 100L when(anyType){ is Long -> println("the value has a Long type") is String -> println("the value has a String type") else -> println("undefined") } val value = 27 val ranges = 10..50 when(value){ in ranges -> println("value is in the range") !in ranges -> println("value is outside the range") else -> println("value undefined") } val x = 11 when (x) { 10, 11 -> print("the value between 10 and 11") 11, 12 -> print("the value between 11 and 12") } val x = 10 when (x) { 5 + 5 -> print("the value is 10") 10 + 10 -> print("the value is 20") }
  • 28. Enumeration fun main() { val color: Color = Color.GREEN when(color){ Color.RED -> print("Color is Red") Color.BLUE -> print("Color is Blue") Color.GREEN -> print("Color is Green") } } enum class Color(val value: Int) { RED(0xFF0000), GREEN(0x00FF00), BLUE(0x0000FF) } //output : Color is Green
  • 29. While Perulangan fun main() { var counter = 1 while (counter <= 5){ println("Hello, World!") counter++ } } fun main() { println("Hello World") println("Hello World") println("Hello World") println("Hello World") println("Hello World") } =
  • 30. fun main() { var counter = 1 while (counter <= 7){ println("Hello, World!") counter++ } } cek dulu baru jalankan While vs Do While fun main() { var counter = 1 do { println("Hello, World!") counter++ } while (counter <= 7) } jalankan dulu baru cek
  • 31. Hati - Hati dengan infinite loop Karena kondisi tidak terpenuhi var value = 'A' do { print(value) } while (value <= 'Z') var i = 3 while (i > 3) { println(i) i-- }
  • 32. val rangeInt = 1.rangeTo(10) = val rangeInt = 1..10 = val rangeInt = 1 until 10 dari bawah ke atas rangeTo vs downTo val downInt = 10.downTo(1) dari atas ke bawah
  • 33. For Loop Perulangan dengan counter otomatis fun main() { val ranges = 1..5 for (i in ranges){ println("value is $i!") } } fun main() { var counter = 1 while (counter <= 5){ println("value is $counter!") counter++ } } =
  • 34. For Each Perulangan dengan counter otomatis fun main() { val ranges = 1..5 ranges.forEach{ println("value is $i!") } } fun main() { val ranges = 1..5 for (i in ranges){ println("value is $i!") } } =
  • 35. Break & Continue Contoh program deteksi angka ganjil sampai angka 10 fun main() { val listNumber = 1.rangeTo(50) for (number in listNumber) { if (number % 2 == 0) continue if (number > 10) break println("$number adalah bilangan ganjil") } } * % adalah modulus / sisa pembagian misal 10 % 2 == 0, 11 % 2 = 1 , 9 % 6 = 3 /* output: 1 adalah bilangan ganjil 3 adalah bilangan ganjil 5 adalah bilangan ganjil 7 adalah bilangan ganjil 9 adalah bilangan ganjil */
  • 37. OUR LIFE SHOULD BE JUST LIKE MODULUS. DOESN’T MATTER WHAT VALUE IS ENTERED, IT’S RESULT ALWAYS POSITIVE. AND SO SHOULD BE OUR LIFE IN EVERY SITUATION - Pranay Neve ’’ ’’
  • 38. You can find me at: ● Google : Ahmad Arif Faizin ● Discord : @arifaizin Thanks! Any questions?