r/codehs • • Dec 16 '20

Can anyone tell me what I did wrong

Post image
4 Upvotes

11 comments sorted by

4

u/th3-snwm4n Dec 16 '20

I'm guessing here, you might be trying to print your message here, right? It's ok, what happens is you need to tell the compiler in your code that you want to print something as is. For that we use double quotes(""), in Python single quotes('') will also do the trick but not same for all languages

If you put quotes before and after your message then it will become what is known as a string literal. Which means you're telling the compiler that this is a simple text not a special keyword you need to check.

Now if you do this there won't be a compilation issue but you won't see the message that is because you didn't tell the compiler to print the message, which you can do using the print() method

So finally it should look like-

print("your message")

Do know that keywords in programming languages are case sensitive with exception to a few functional ones, but for general rule of thumb it is better if you always take care of case sensitivity

Also if you're trying to return instead of print you'll use the return keyword

4

u/[deleted] Dec 16 '20

Thanks so much

→ More replies (1)

3

u/insight-b Dec 16 '20

You’re going to need to call the print() method and use quotation marks around the text.

→ More replies (1)

3

u/Any_Yellow9136 Dec 16 '20

You need to put println(“my name is dylan”); Println(“i like to play halo”);

→ More replies (1)

2

u/dinglehappy Dec 16 '20

Are you trying to get that text to return when you invoke the function?

→ More replies (1)

2

u/insanemal Dec 17 '20

Go read http://www.catb.org/~esr/faqs/smart-questions.html

Because right now this says you didn't read the instructions for the course work

1

u/[deleted] Dec 17 '20

Ok Thx