Skip to content

Instantly share code, notes, and snippets.

View aysesenses's full-sized avatar
🎯
Focusing

Ayşe ŞENSES aysesenses

🎯
Focusing
  • Turkey
View GitHub Profile
{ println("Hello")}()
//Hello
println("Hello")
//Hello
val swim = { println("swim \n")}
swim()
//swim
val decorations = listOf ("rock", "pagoda", "plastic plant", "alligator", "flowerpot")
println(decorations.filter {true})
println(decorations.filter {it[0] == 'p'})
import java.util.*
fun main(args: Array<String>) {
println("Hello, ${args[0]}!")
readABook()
}
fun readABook() {
val day = randomDay()
val book = readBook(day)
fun readAStory() = println("Read a Story")
fun readAPoem() = println("Read a Poem")
var readStory = 0
var readPoem = 0
while (readStory < 5) {
readAStory()
readStory ++
}
val read = listOf("story", "poem", "novel")
for (r in read) { // 1
println("Read a $r .")
}
data class Person(var name: String, var age: Int, var about: String) {
constructor() : this("", 0, "")
}
fun writeCreationLog(person: Person) {
println("A new person ${person.name} was created.")
}
val adam = Person("Adam", 23, "Android developer")
.also {
class Company() {
var name: String
var objective: String
var founder: String
}
var company: Company? = null
company?.run {
final String msg = num > 10 ? "Number is greater than 10" : "Number is less than or equal to 10";
data class Person(var name: String, var age: Int = 0, var city: String = "",var country: String = "")
val adam = Person("Adam").apply {
age = 24
city = "Amsterdam"
country = "Germany"
}
with(adam){
print("$age")
}
data class Person(var name: String, var age: Int = 0, var city: String = "",var country: String = "")
val adam = Person("Adam").apply {
age = 24
city = "Amsterdam"
country = "Germany"
}
println(adam)