Read String Data Input in Kotlin

Definition

In Kotlin, readLine() reads a line of input from the standard input stream or screen.

Syntax

var variable_name = readLine()

// Kotlin Defintion
fun readLine(): String? (source)

Read String in Kotlin Example Program

// Read String in Kotlin example program
// Data Input Kotlin Programs, Basic Kotlin Programs

fun main(args: Array < String > ) {
    
    println("Pleas enter the Name")

    var name = readLine()!!
    println("Name is : $name")
}

Sample Output

Pleas enter the Name
GOODMAN
Name is :GOODMAN