Skip to content
← Back to Community
how do I add code to my comments?
Profile icon
therealperson

I've been trying to type my code on a comment but I cannot understand how

Answered by Bookie0 [earned 5 cycles]
View Answer
Voters
Profile icon
therealperson
Comments
hotnewtop
Profile icon
Bookie0

You can't.

Comments are used for explaining your code, making it more readable, and to prevent execution when testing code.

This is how to comment:

# this is a comment # it starts with a hashtag # # Python will ignore and not run anything after the hashtag

You can also have multiline comments:

""" this is a multiline comment I can make it very long! """

so if you have code preceded by a comment:

# print("Hello World!") # name = input("Enter you name")

These two bits of code above won't run as they are commented out. ;)

Profile icon
Philip-TT

Waow this is quite pleasant article, my sister love to read such type of post, I am going to tell her and bookmarking this webpage. Thanks CRM consulting services

Profile icon
Philip-TT

This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck. CBD oil for dogs

Profile icon
Philip-TT

It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing. CBD night cream

Profile icon
therealperson

print(“hi”)

Profile icon
therealperson

oh so just this

Profile icon
therealperson

ok

Profile icon
therealperson

#ok

Profile icon
therealperson

oh ok

Profile icon
therealperson

oh ok

Profile icon
RYANTADIPARTHI

If this is in python, try this way.

# print("hi") print("hi") # these are comments just put a hash

You need to put a # and start typing in it. another multiline comment in python is '''.

''' kjenvlsf sdfkvjnsf vkjdfnv lndfv kjndf '''

Like that

Profile icon
NoNameByProgram

There are 2 comments:

  1. The Coding Comment (most likely what you're looking for)
    The language skips that comment.
// console.log("hi") console.log("bye") // output: bye
  1. The Repl.it Comment on Post
    This is easy. Use a single backtick and another backtick at the end of the code for this and for a multi-line code, use 3 backticks each having a respective line.
Hi there! My name is [CORRUPTED]
Profile icon
realTronsi

@NoNameByProgram your "repl comment" is called a code block, this is a comment:

Hi i am a comment using '>' character

Profile icon
NoNameByProgram

@realTronsi crap XD i get mixed up

Profile icon
Coder100

Comments remove code.
Make a newline so you can type in more code:

# def something(): def something(): print("hi!")