First, what's a comment in code? Well im crap at explaining things, but the wiki isn't!
Quoting the wiki, a comment is "text embedded in source code that a translator (compiler or interpreter) ignores." In slightly simpler words for your brain rot infected brains, its adding text into your code that is ignored. Its not used to make your program.
Comments can be used for pretty much anything you see fits, but there are some main uses. Comments are commonly used in code to explain what a piece of code is doing, to make code more readable and easier to understand, and to be able to temporarily get "rid" of a piece of code without really deleting it.
Anyways, here is how to write comments:
Comments in html: opening tag: <!-- closing tag: --> Example: <!-- This section of my webpage describes all about apples. -->. It does not matter whether or not you have a multi-line comment or not, it still works as long as you have the right opening and closing tags at the start and end.
single line comments in java: // (the slashes are just at the start of the comment, that's it)
multi-line comments in java: starts with /* and ends with */ (For multi-lined comments i usually just add // in front of every line and that still works but do whatever you prefer).
Example for single-lined comments in java: //karel will turn right by turning left 3 times Example (multi-lined comments): /* karel will turn right by turning left 3 times. */
Comments in python: start with just a #. For multi-line comments, you just add a hashtag in front of every line.
Example for python comment: #tracy draws a red triangle, and fills it in. Another python example: #tracy keeps drawing squares that #get bigger and bigger until they fill #up the whole canvas.
if somebody wants me to show examples of it in actual code lmk, and if you have any other questions, let me know as well. I'm not the best at explaining things, sorry :(
Comments
Displaying 1 of 1 comments ( View all | Add Comment )
Em
here is a better example of multi-lined comments in python since the formatting was off
#tracy will keep drawing squares
#that get bigger and bigger
#until they fill up the canvas