+ 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....

30th Apr 2021, 6:39 PM
Abhishek Biswas
Abhishek Biswas - avatar
20 ответов
+ 6
Just give the space after John
30th Apr 2021, 6:41 PM
Atul [Inactive]
+ 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 + "!") }
30th Apr 2021, 6:52 PM
A͢J
A͢J - avatar
+ 3
🅰🅹 🅐🅝🅐🅝🅣 before exclamation mark or after comma?
30th Apr 2021, 6:44 PM
Atul [Inactive]
+ 3
Abhishek Biswas use lower case letters for println and var
30th Apr 2021, 6:46 PM
Atul [Inactive]
+ 3
🅰🅹 🅐🅝🅐🅝🅣 Atul thanks ...I got that..
30th Apr 2021, 6:50 PM
Abhishek Biswas
Abhishek Biswas - avatar
+ 3
🅰🅹 🅐🅝🅐🅝🅣 yes...that the right one ....
30th Apr 2021, 6:54 PM
Abhishek Biswas
Abhishek Biswas - avatar
+ 3
Atul ok ..bro I will...
30th Apr 2021, 7:23 PM
Abhishek Biswas
Abhishek Biswas - avatar
+ 3
Hi fun main (args:Array<String>){ var name = readLine()!!.toString() println("Welcome, $name !") } Just Enter 😉
23rd Jun 2021, 12:48 PM
Hassan Ghobeyshvi
Hassan Ghobeyshvi - avatar
+ 2
Abhishek Biswas There should be space after comma
30th Apr 2021, 6:42 PM
A͢J
A͢J - avatar
+ 2
Atul Space should be after comma not after exclamation mark.
30th Apr 2021, 6:45 PM
A͢J
A͢J - avatar
+ 2
Atul actually it done by my mobile when I typing that ...
30th Apr 2021, 6:49 PM
Abhishek Biswas
Abhishek Biswas - avatar
+ 2
fun main (args: Array <String>){ var name = readLine() println("Welcome,"+name+"!") } //🅰🅹 🅐🅝🅐🅝🅣 Is this the correct soln?
30th Apr 2021, 6:49 PM
Atul [Inactive]
+ 2
🅰🅹 🅐🅝🅐🅝🅣 Sorry for that because at a first glance of the question it was seeming that only
30th Apr 2021, 7:20 PM
Atul [Inactive]
+ 2
Abhishek Biswas ya while typing it happens but change it.
30th Apr 2021, 7:21 PM
Atul [Inactive]
+ 2
//using functions. fun welcome(name:String){ println("welcome ${name} !") } fun main(args: Array<String>){ var name=readLine()!!.toString() welcome(name) }
23rd Jun 2021, 6:35 PM
Coding King.
Coding King. - avatar
+ 1
fun main(args: Array<String>) { var name = readLine() println("Welcome, $name!") }
8th Mar 2023, 10:44 AM
Yusuf August
Yusuf August - avatar
0
Nobody asked :)
29th Jun 2021, 8:54 AM
Saucy Susan
0
Hi
5th Sep 2021, 5:08 AM
yassir
yassir - avatar
0
Console.log("Welcome, " + name + "!");
26th Dec 2022, 4:45 PM
Umal-Rozi
Umal-Rozi - avatar
0
fun main(args: Array<String>) { var x = readLine() println("welcome," + x + '!') } Please help me! I am getting error
25th Jun 2023, 12:27 PM
Dixitji
Dixitji - avatar