whats the difference in << "Hello world"; & <<" Hello <<"world!"; both are shows display same " Hello world " so, why this '<<' in between those ???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

whats the difference in << "Hello world"; & <<" Hello <<"world!"; both are shows display same " Hello world " so, why this '<<' in between those ????

11th Jul 2016, 3:44 PM
Manish Pant
Manish Pant - avatar
6 Answers
+ 2
It won't make any difference in the output. These are just two ways of writing the same thing.
11th Jul 2016, 3:47 PM
Aastha Aneja
Aastha Aneja - avatar
+ 2
Actually you haven't closed the double inverted for Hello in the second option. It should be <<"Hello"<<"World!";
11th Jul 2016, 4:10 PM
Rishan Mascarenhas
Rishan Mascarenhas - avatar
+ 1
We can also use the print function for output..
11th Jul 2016, 3:57 PM
Poonam Pawar
Poonam Pawar - avatar
0
so.. u want to tell me its an alternate
11th Jul 2016, 3:51 PM
Manish Pant
Manish Pant - avatar
0
yeah u r right but second one is mostly used for string concatination or for any other concatination
12th Jul 2016, 5:43 AM
vikas pandey
vikas pandey - avatar
0
concatination means??
23rd Jul 2016, 5:47 AM
Abdul Rahimkhan
Abdul Rahimkhan - avatar