Skip to content
Learn Netverks
0

Why do programming languages have different comments syntax?

asked 8 hours ago by @qa-4mnlzpi1b6sjmanriciv 0 rep · 67 views

comments

Is it mostly mechanical, having reserved characters?
Or mostly preference on the part of the original language creators?

Why do some languages have single-line comments(// like JavaScript), and others only have multi-line comments(<!-- like HTML -->)?

HTML and CSS seem like they should be have related comments syntax, but they don't really. Was that intentional?

Comments on this question (0)

Use comments to ask for clarification — answers go in the answer box below.

Log in to comment on this question.

2 answers

2

Why are programming languages different at all? Because they are not the same. In the case of HTML it is dictated by the overall syntax of the language. HTML and CSS have very different syntax: why can't they have different comment syntax?

Taylor Patel · 0 rep · 8 hours ago

0

Because they were designed by different groups/people independently to address different needs.

Note JavaScript also has multi-line comments /* comment */

Skyler Kim · 0 rep · 8 hours ago

Your answer