enrique-j
6/19/2018 - 7:07 PM

String

https://www.youtube.com/watch?v=hteNta7eucI

import java.util.*

fun main(args: Array<String>){

    println("Escribe tu nombre o enter")
    val scanner = Scanner(System.`in`)
    val nextLine = scanner.nextLine()
    val name = if(nextLine != "") nextLine else "Kotli"

    println("hola $name !!") //se puede escribir un String template
    
}

//segunda forma

import java.util.*

fun main(args: Array<String>){

    println("Escribe tu nombre o enter")
    val scanner = Scanner(System.`in`)
    val nextLine = scanner.nextLine()
    val name = if(nextLine != "") nextLine else "Kotli"

    println("hola ${if(nextLine != "") nextLine else "Kotli"} !!")
}