var a = 34
val b : Int = 45
println("$a $b")

//var a = 34
//let b : Int = 45
//print(a, b)

fun greet(str: String): Unit {
println(str)
}
greet("Hello")

//func greet(str : String) -> Void {
//
// print(str)
//
//}
//greet(str: "Hello")


val c = 10
val d = 10L
val e = 10.0f
val f = 10.0

//let c = 10
//let d : Int64 = 10
//let e : Float = 10
//let f = 10.0

var str = """
This is
a kotln
for Android.
"""
println(str)

//let str = NSLocalizedString("""
// This is
// a kotln
// for Android.
// """, comment: "")

var str1 = "hello"
if (str1 == "hello") {
println("say hello..!")
} else {
println("no hello..!")
}

//var str1 = "hello"
//if (str1 == "hello") {
// print("say hello..!")
//} else {
// print("no hello..!")
//}

var str2 = "Hello"
println(str2 + "...!") //Java
println("$str2 ...!")
println("${str2} ...!")

//var str2 = "Hello"
//print(str2 + "...!")
//print(str2 + " " + "...!")

val numbers: Array<Int> = arrayOf(1, 2, 3, 4, 5)
val numbers2 = arrayOf(1, 2, 3, 4, 5)
numbers[0] = 5

//var numbers : Array<Int> = [1, 2, 3, 4, 5]
//let numbers2 = [1, 2, 3, 4, 5]
//numbers[0] = 5

val g = 10
val h = 20
var max = g
if (g < h) max = h
println(max)

//let g = 10
//let h = 20
//var max = g
//if g < h {max = h}
//print(max)

if (g > h) {
max = g
} else {
max = h
}
println(max)

//if (g > h) {
// max = g
//} else {
// max = h
//}
//print(max)

val max2 = if (a > b) a else b
println(max2)

//var max2 = ( a < b ) ? a : b
//print(max2)

val x = 1
when(x) {
1 -> println("x == 1")
2, 3 -> println("x == 2 or x == 3")
in 4..7 -> println("4부터 7사이")
!in 8..10 -> println("8부터 10사이가 아님")
else -> {
print("x는 1이나 2가 아님")
}
}

//let x = 1
//switch x {
// case 1:
// print("x == 1")
// case 2, 3:
// print("x == 2 or x == 3")
// case 4..<7:
// print("4부터 7사이")
// case (let test) where test > 7 || test < 1:
// print("7보다 많거나 1보다 작음")
// default:
// print("defalt")
//}
val numberStr = 1
val numStr = when (numberStr % 2) {
0 -> "짝"
else -> "홀"
}
println(numStr)

//let numberStr = 1
//switch (numberStr % 2) {
//case 0: let numStr = "짝"
// print(numStr)
//default:
// print("홀")
//}

val number = 1
fun isEven(num : Int) = when (num % 2) {
0 -> "짝"
else -> "홀"
}
println(isEven(number))

//let number = 1
//func isEven(num : Int) -> String {
// switch (num % 2) {
// case 0:
// return "짝"
// default:
// return "홀"
// }
//}
//
//print(isEven(num: numberStr))

val numbers1 = arrayOf(1, 2, 3, 4, 5)
for (num in numbers1) {
println(num)
}

//var numbers1 : Array<Int> = [1, 2, 3, 4, 5]
//for num in numbers1 {
// print(num)
//}

for (i in 1..3) {
println(i)
}
for (i in 0..10 step 2) {
println(i)
}
for (i in 10 downTo 0 step 2) {
println(i)
}

//for i in 1...3 {
// print(i)
//}
//for i in stride(from:0, through: 10, by: 2) {
// print(i)
//}
//for i in stride(from: 10, through: 0, by: -2) {
// print(i)
//}

var x1 = 10
println(x1)
while (x1 > 0) {
x1--
println(x1)
}

var x2 = 10
do {
x2--
println(x2)
} while (x2> 0)

//var x1 = 10
//print(x1)
//while (x1 > 0) {
// x1 -= 1
// print(x1)
//}
//
//var x2 = 10
//repeat {
// x2 -= 1
// print(x2)
//} while (x2 > 0)

//class Person {
//
//}
//
//var person = Person()

//class Person {
//
//}
//
//var person = Person()


class Person(var name: String) {

}

//another way in kotlin
//class Person(name : String) {
// init {
// println(name)
// }
//}

//swift
//class Person {
// var name : String
// init() {
// self.name = ""
// }
//}
// -or-
//class Person {
// var name : String?
//}
//var person = Person()