mirror of
https://github.com/ASDjonok/OOP_IO-2x_2023.git
synced 2025-06-07 22:49:24 +03:00
Added a Kotlin variation.
This commit is contained in:
parent
64c9e43742
commit
a8cbadbe7d
@ -1,10 +1,10 @@
|
||||
fun protectedInput(variableName: String): Int {
|
||||
do {
|
||||
try {
|
||||
print("Enter $variableName: ");
|
||||
print("Enter $variableName: ")
|
||||
return readln().toInt()
|
||||
} catch (e: Exception) {
|
||||
println("${variableName.uppercase()} must be an integer!");
|
||||
println("${variableName.uppercase()} must be an integer!")
|
||||
}
|
||||
} while (true)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user