Skip to content

Instantly share code, notes, and snippets.

View codinginflow's full-sized avatar

Coding in Flow codinginflow

View GitHub Profile
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 01:57
Kotlin for Beginners Part 3
fun main() {
println("Hello, world!")
}
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:01
Kotlin for Beginners Part 4
fun main() {
val userName = "Florian"
var age = 28
println("Hello, world! My name is $userName. I am $age years old. In 2 years, I'll be ${age + 2}.")
}
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:03
Kotlin for Beginners Part 5
fun main() {
val exampleString = "\"Florian\nWalther\""
val exampleRawString = """ "Florian
Walther" """
print(exampleRawString)
val exampleNumber: Double
exampleNumber = 2_000_000.12
val exampleLong: Long = exampleNumber.toLong()
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:04
Kotlin for Beginners Part 6
fun main() {
var a = 5
val b = 3.0
println("a = " + a + " b = " + b)
println("a + b = ${a + b}")
println("a - b = ${a - b}")
println("a * b = ${a * b}")
println("a / b = ${a / b}")
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:05
Kotlin for Beginners Part 7
fun main() {
var a = 5
val b = 3.0
println("a = " + a + " b = " + b)
println("a + b = ${a + b}")
println("a - b = ${a - b}")
println("a * b = ${a * b}")
println("a / b = ${a / b}")
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:07
Kotlin for Beginners Part 8
fun main() {
var a = 5
val b = a.toLong()
println("a = " + a + " b = " + b)
// println("a + b = ${a + b}")
println("a - b = ${a - b}") // subtracts b from a
println("a * b = ${a * b}")
println("a / b = ${a / b}")
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:08
Kotlin for Beginners Part 9
fun main() {
val names = arrayOf("Jim", "John", "Jenny", "Jamie")
names[0] = "Jeremy"
println("Number of elements: ${names.size}")
println("First element: ${names[0]}")
println("Last element: ${names[2]}")
}
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:09
Kotlin for Beginners Part 10
fun main() {
val names = arrayOf("Jim", "John", "Jenny", "Jamie")
//for (name in names) println(name)
names.indices
//Index: ___ Element: ___
//for (i in 1..10) println(i)
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:10
Kotlin for Beginners Part 11
fun main() {
println("2 > 1 is ${2 > 1}")
println("2 < 1 is ${2 < 1}")
println("1 >= 1 is ${1 >= 1}")
println("1 == 1 is ${1 == 1}")
println("1 == 2 is ${1 == 2}")
println("1 != 2 is ${1 != 2}")
println("!(2 > 1) is ${!(2 > 1)}")
@codinginflow
codinginflow / KotlinTutorial.kt
Created February 15, 2021 02:13
Kotlin for Beginners Part 12
fun main() {
var i = 0
outer@ do {
println(i)
i++
//continue
var j = 0