Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Are comments in the code considered syntax?

You know how you can make comments in the code like

//Best work ever

Is that considered Syntax?

2 Answers

"Syntax" of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.

So, to have a comment you must use the correct programming "Syntax" for your programming language.

In this case for swift and iOS programming the syntax of a comment is preceded with // This is the programming language's syntax to identify a comment.

A comment itself isn't syntax. How you have to enter a comment for the IDE to recognize it as a comment is the Syntax.

Hope this helps and I know I just repeated myself but tried to word it various ways to hope you understand what I was trying to explain.

Thank you so much

I am not sure what you mean by syntax, but yes that is a commenting syntax. Depending on if you are doing swift or objective C there might be more ways to comment.

What do you mean by your not sure what I mean by syntax?

If you are asking if it is part of the coding syntax or it is considered a syntax error. I am not sure if I understood the right thing, according to your question, but I replied to it being a form of coding syntax.