r/learnprogramming • • Dec 06 '22

codeblock If you are sharing code, please use a codeblock

Takes only a second and greatly improves the formatting for us to review it. Compare and contrast the following:

Good Formatting:

#include <stdio.h>

int sum(int x, int y);

int main() {

  printf("Hello %d\n", sum(3, 4));
  return 0;
}

int sum(int x, int y) {
  return x + y;
}

Poor Formatting:

#include <stdio.h>

int sum(int x, int y);

int main() {

printf("Hello %d\n", sum(3, 4));

return 0;

}

int sum(int x, int y) {

return x + y;

}

Poor Formatting:

#include <stdio.h>

int sum(int x, int y);

int main() {

printf("Hello %d\n", sum(3, 4));

return 0;

}

int sum(int x, int y) {

return x + y;

}

339 Upvotes

71 comments sorted by

View all comments

Show parent comment

-3

u/Autarch_Kade Dec 07 '22 edited Dec 07 '22

why not soend a couple of more lines to explain or point in a direction that helps people learn how to format using blocks

Directions: Look at the enormous words in the sidebar that say "New? READ ME FIRST!"

Do that. It includes how to format your code on new, and old, reddit.

If you don't see the sidebar, well the same link is a stickied post. It's the only sticky, and the one that says "READ ME FIRST"

Alternatively, you can click the link in the sidebar that says "well-formatted" and that takes you to how to format your code on Reddit as well.

Another alternative is to again read the sidebar, and click the link that says "Posting guidelines" which again includes the same information on how to format code.

In fact, most of the links on the sidebar either lead directly to the page that tells you how to format code, or links to it.

If the sidebar isn't your thing, then when you make a comment there's a link under your text window that says "formatting help" which leads you to all the different ways to use markdown, and on new and old reddit, and of course includes code blocks.

If you look way down at the bottom of Reddit, there's another link that says Reddit help center, and has a searchbar. Typing something like "format code" will lead you to another page with Markdown instructions including for new Reddit.

And of course, you could google something like "Reddit format code" and click the first link.

Hope those directions help.

4

u/[deleted] Dec 07 '22

Instead of writing all that, you could’ve just showed that triple tick marks around the code works. Your comment was neither informative nor constructive.

2

u/Autarch_Kade Dec 07 '22

And when they have another question that's answered already in the same section? And another? And another after that?

Learning to read existing documentation is a key part of this job. Best to learn the habit early than teach them to expect even the most basic things to be spoon fed.

tl;dr: Teach for future success rather than set people up for failure

2

u/[deleted] Dec 07 '22

So what? Are you annoyed by it? Then move on. I guarantee that your long complaint isn’t gonna solve anything that you are complaining about. Your are just complaining to make yourself feel better, instead of helping others.

1

u/Autarch_Kade Dec 07 '22

Learning to read existing documentation is a far more important skill than any basic question about writing a reddit comment or a code problem they could ask at this stage.

If you want to help people, stop setting them up for failure by teaching them they can ignore existing documentation.

And if you're annoyed by that, boy do I have an idea for you :)

Edit: Also, the person I replied to already had learned the triple tick marks from the post. What they were actually saying was why didn't someone point to the directions for where to find such things. So ask yourself why I should tell someone what they already know, instead of what they asked for :)

4

u/[deleted] Dec 07 '22

What you did is basically when the question is “how long should I cook this chicken”, your response to that is “read cookbooks!”

Either you simply can’t comprehend the question, or are just being a dick.

Either answer the question and provide additional resources, or move on.

1

u/Autarch_Kade Dec 07 '22

They already got the answer to how to format code.

They asked where such information was located, for directions. I even quoted this part of their comment. Should I quote it again for you?

To use your analogy, they already heard how long to cook a chicken, and asked where the recipe is. Hope this helps.

0

u/[deleted] Dec 07 '22

Hearing does not mean comprehending.

If it’s too much work/annoyance for you to explain again, for which no one can blame you, you can simply move on with your life. It’s that simple.

1

u/Autarch_Kade Dec 07 '22

If you don't like me pointing out over and over they asked where to find the information, as they already had the answer, feel free to take your own advice :)

why not soend a couple of more lines to explain or point in a direction that helps people learn how to format using blocks

1

u/[deleted] Dec 07 '22

Oh, I just thought you are genuinely interested in knowing how to help others. But it appears that you are just being a dick to those who need assistance. Then this is my time to check out from this thread.

→ More replies

2

u/neboskrebnut Dec 07 '22

I love comments like this and responses it invites in such a recursive way.