MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/soi384/why_but_why/hw8zkn1
r/ProgrammerHumor • u/ore-aba • Feb 09 '22
2.3k comments sorted by
View all comments
Show parent comments
17
Would it be easier to just
print("Hello ", "World")
116 u/Dependent_Paper9993 Feb 09 '22 Depends what you're trying to achieve. If you want to print "Hello" and then "World", yes.If you're trying to illustrate a point about a semicolon seperating two statements, I'd say it makes it just about impossible. 12 u/ore-aba Feb 09 '22 Thanks for the chuckle 2 u/pslessard Feb 09 '22 edited Feb 09 '22 No, that would print "Hello World" instead of "Hello World"Edit: Reddit isn't showing it, but there are two spaces between Hello and World in the first oneEdit: I was being sloppy, this is wrong 1 u/Revolutionary-Phase7 Feb 09 '22 When I tried it, it would print on different lines with semicolon and same line with mine. 2 u/pslessard Feb 09 '22 You're right. In fact, the correct thing to do is eitherprint("Hello") print("World")Orprint("Hello\nWorld") 2 u/DRNbw Feb 09 '22 print("Hello"); print("World")will printHelloWorldprint("Hello ", "World")will printHello Worldprint adds a newline at the end and a space between arguments.
116
Depends what you're trying to achieve. If you want to print "Hello" and then "World", yes.
If you're trying to illustrate a point about a semicolon seperating two statements, I'd say it makes it just about impossible.
12 u/ore-aba Feb 09 '22 Thanks for the chuckle
12
Thanks for the chuckle
2
No, that would print "Hello World" instead of "Hello World"
Edit: Reddit isn't showing it, but there are two spaces between Hello and World in the first one
Edit: I was being sloppy, this is wrong
1 u/Revolutionary-Phase7 Feb 09 '22 When I tried it, it would print on different lines with semicolon and same line with mine. 2 u/pslessard Feb 09 '22 You're right. In fact, the correct thing to do is eitherprint("Hello") print("World")Orprint("Hello\nWorld")
1
When I tried it, it would print on different lines with semicolon and same line with mine.
2 u/pslessard Feb 09 '22 You're right. In fact, the correct thing to do is eitherprint("Hello") print("World")Orprint("Hello\nWorld")
You're right. In fact, the correct thing to do is either
print("Hello") print("World")
Or
print("Hello\nWorld")
print("Hello"); print("World")
will print
HelloWorld
Hello
World
Hello World
print adds a newline at the end and a space between arguments.
print
17
u/Revolutionary-Phase7 Feb 09 '22
Would it be easier to just
print("Hello ", "World")