Introduce Common readln() and readlnOrNull() top-level functions #KT-48456
This commit is contained in:
committed by
Space
parent
14b66872b5
commit
97eb28144f
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
print("${readlnOrNull()}/${readlnOrNull()}/${readlnOrNull()}")
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
null/null/null
|
||||
@@ -0,0 +1,2 @@
|
||||
aaaaaa
bbb
|
||||
c
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
print(readln())
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
aaaaaa
bbb
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
print(readln())
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Привет!
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
print(readln())
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Привет!
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
readln()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
print(readln())
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
A very long line of input with length of more than initial buffer size
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
print(readln())
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
A very long line of input with length of more than initial buffer size
|
||||
@@ -0,0 +1,3 @@
|
||||
Hello World
|
||||
Second line
|
||||
Third line
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
print(readln())
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Hello World
|
||||
@@ -0,0 +1,4 @@
|
||||
first
|
||||
second
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
print("${readln()}/${readln()}/${readln()}/${readln()}/${readlnOrNull()}")
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
first/second///null
|
||||
Reference in New Issue
Block a user