logo

Academy

DocumentationSubmit a solution

Style

The style rules that your source code must obey: English, indent, line length, names and spaces.

NOTE: Obey these instructions. They save your time, and they show your reading comprehension.

The source code must obey these rules. Use a different rule only when the language does not permit one of them.

  1. Write the code in English. Write the comments in English too.

  2. Use an indent of 2 spaces. Do not use a tab.

  3. A line must have 80 characters or less.

  4. A line must have no debug comment.

  5. Put one empty line between two function definitions. Use a different quantity only when the linter or the language needs it.

  6. Put one space on each side of a binary operator and of a ternary operator. Use a different quantity only when the linter or the language needs it. These are examples of those operators:

    = + - < > * / % | & ^ <= >= == != ? :

  7. Do not use a variable name such as x, y, z or i. Use a name that gives information. For example, write const_x for a constant.

  8. Some languages have a syntax that is not similar to the usual one. Haskell and OCaml are two examples. For those languages, read the style guide of the language and obey it. But obey the rules above when you can.

These rules are for the code that you upload. When you put code in a work item, write it as text, in a code block. Do not use an image of the code. Question template gives the rest of that format.