+ 5
Kotlin question.....
You are working on a notification system. Your program needs to take the name of the user as input and output "Welcome, name!", where name is the input value. Sample Input John Sample Output Welcome, John! You can use the + operator to combine strings in the output. I use fun main (args: Array <String>){ Var name = readLine() Println("Welcome,"+name+"!") } I am getting error showing Welcome,John ! But answer is Welcome,John! Help me .....to fix this error....
20 Answers
+ 6
Just give the space after John
+ 4
Atul
No, because there is no space after comma.
This is correct one.
fun main (args: Array <String>){
var name = readLine()
println("Welcome, " + name + "!")
}
+ 3
🅰🅹 🅐🅝🅐🅝🅣 before exclamation mark or after comma?
+ 3
Abhishek Biswas use lower case letters for println and var
+ 3
🅰🅹 🅐🅝🅐🅝🅣 yes...that the right one ....
+ 3
Atul ok ..bro I will...
+ 3
Hi
fun main (args:Array<String>){
var name = readLine()!!.toString()
println("Welcome, $name !")
}
Just Enter 😉
+ 2
Abhishek Biswas
There should be space after comma
+ 2
Atul
Space should be after comma not after exclamation mark.
+ 2
Atul actually it done by my mobile when I typing that ...
+ 2
fun main (args: Array <String>){
var name = readLine()
println("Welcome,"+name+"!")
}
//🅰🅹 🅐🅝🅐🅝🅣 Is this the correct soln?
+ 2
🅰🅹 🅐🅝🅐🅝🅣 Sorry for that because at a first glance of the question it was seeming that only
+ 2
Abhishek Biswas ya while typing it happens but change it.
+ 2
//using functions.
fun welcome(name:String){
println("welcome ${name} !")
}
fun main(args: Array<String>){
var name=readLine()!!.toString()
welcome(name)
}
+ 1
fun main(args: Array<String>) {
var name = readLine()
println("Welcome, $name!")
}
0
Nobody asked :)
0
Hi
0
Console.log("Welcome, " + name + "!");
0
fun main(args: Array<String>) {
var x = readLine()
println("welcome," + x + '!')
}
Please help me!
I am getting error