r/ProgrammerHumor • • Feb 05 '18

StackOverflow in a nutshell.

Post image
16.2k Upvotes

1.2k comments sorted by

View all comments

Show parent comments

2

u/[deleted] Feb 06 '18

I don't know what it meant. I assume you mean organizing your code better?

7

u/Nicd Feb 06 '18

It means a "syntax shortcut" sort of. An alternative syntax to write something that is faster / cleaner. Like in JavaScript default arguments function foo(a=1) {...} are basically syntactic sugar over the old way of manually checking if each argument was given and setting the proper value: function foo(a) { if (a === undefined) a = 1; ... }

5

u/[deleted] Feb 06 '18

Oh I see. I know it as shorthand syntax.

1

u/IAmNotNathaniel Feb 06 '18

I can understand if, in this post, people are seeing this phrase for the first time and are confused by it.

However, the only times I've ever seen it used are in some context like:

So now we do this syntactic sugar to make things easier

followed by some bit of code that makes things cleaner to read. It's not even a programming term, just some descriptive language people use.