Difference between revisions of "KOTLIN: Control Flow"
Onnowpurbo (talk | contribs) (Created page with "Sumber: https://www.tutorialspoint.com/kotlin/kotlin_control_flow.htm Kotlin flow control statements determine the next statement to be executed. For example, the statements...") |
Onnowpurbo (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
Kotlin flow control statements determine the next statement to be executed. For example, the statements if-else, if, when, while, for, and do are flow control statements. | Kotlin flow control statements determine the next statement to be executed. For example, the statements if-else, if, when, while, for, and do are flow control statements. | ||
− | Flow Chart for Control Flow | + | Pernyataan kontrol aliran Kotlin menentukan pernyataan berikutnya yang akan dieksekusi. Misalnya, pernyataan if-else, if, when, while, for, dan do adalah pernyataan flow control. |
+ | |||
+ | |||
+ | ==Flow Chart for Control Flow== | ||
+ | |||
Control flow can be depicted using the following Flow Chart: | Control flow can be depicted using the following Flow Chart: | ||
− | Control Flow Chart | + | Alur kendali dapat digambarkan dengan menggunakan Bagan Alir berikut: |
− | + | ||
− | + | [[File:Control flow chart.jpg|center|400px|thumb|Control Flow Chart]] | |
+ | |||
− | Kotlin | + | ==Kotlin Control Flow Statements== |
− | + | This tutorial will take you through all these statements one by one explaining their usage and suitable examples. | |
− | + | Tutorial ini akan membawa Anda melalui semua pernyataan ini satu per satu menjelaskan penggunaannya dan contoh yang sesuai. | |
− | Kotlin While Loop | + | * Kotlin If...Else Expression |
+ | * Kotlin When Expression | ||
+ | * Kotlin For Loop | ||
+ | * Kotlin While Loop | ||
+ | * Kotlin Break and Continue | ||
− | + | ==Quiz Time (Interview & Exams Preparation)== | |
− | |||
Q 1 - Which of the following is true about Control Flow Statement? | Q 1 - Which of the following is true about Control Flow Statement? | ||
Latest revision as of 09:37, 24 July 2022
Sumber: https://www.tutorialspoint.com/kotlin/kotlin_control_flow.htm
Kotlin flow control statements determine the next statement to be executed. For example, the statements if-else, if, when, while, for, and do are flow control statements.
Pernyataan kontrol aliran Kotlin menentukan pernyataan berikutnya yang akan dieksekusi. Misalnya, pernyataan if-else, if, when, while, for, dan do adalah pernyataan flow control.
Flow Chart for Control Flow
Control flow can be depicted using the following Flow Chart:
Alur kendali dapat digambarkan dengan menggunakan Bagan Alir berikut:
Kotlin Control Flow Statements
This tutorial will take you through all these statements one by one explaining their usage and suitable examples.
Tutorial ini akan membawa Anda melalui semua pernyataan ini satu per satu menjelaskan penggunaannya dan contoh yang sesuai.
- Kotlin If...Else Expression
- Kotlin When Expression
- Kotlin For Loop
- Kotlin While Loop
- Kotlin Break and Continue
Quiz Time (Interview & Exams Preparation)
Q 1 - Which of the following is true about Control Flow Statement?
A - Control flow controls the execution of the program
B - Loops and Decision Statements are part of control flow
C - Control flow is an essential part of modern programming languages
D - All of the above
Q 2 - Which of the following is a control flow statement in Kotlin?
A - String
B - Fun
C - When
D - None of the above
Q 3 - If we do not have control flow statements, then it will be almost impossible to write a computer program?
A - True
B - False