+ 4

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
17 Answers
+ 4
Just give the space after John
30th Apr 2021, 6:41 PM
Atul [Inactive]
+ 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]
30th Apr 2021, 6:50 PM
Abhishek Biswas
Abhishek Biswas - avatar
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
+ 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
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
+ 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
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
//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
0
Nobody asked :)
29th Jun 2021, 8:54 AM
Saucy Susan
0
Hi
5th Sep 2021, 5:08 AM
yassir
yassir - avatar