What is a declarative statement?

I Googled the definition; however, I want to confirm if you could please tell me what a declarative statement is?

In a general sense, a query is a declarative statement because it describes something in terms that the language can parse and process. HTML is another example of declarative statements in the form of markup. CSS is also a declarative language since each selector rule describes some property relating to an element or group of elements.

Think in terms of something stated, such as a fact, an item of data, or even a step by step process described as what the steps do. Think, ‘what’ as opposed to ‘how’.

1 Like

Thank you so much for your answer!

I also wonder if you could please tell me what “markup” means?

I Googled the definition, and I found this one:

Markup (Computing) - a set of tags assigned to elements of a text to indicate their relation to the rest of the text or dictate how they should be displayed.

However, what does the word “text” refer to in the above context?

<p>Hello World!</p>

All of the above is text, including and especially the tags, themselves. All of HTML is text. The P element above has a node in the DOM tree called ‘textnode’ which defines the text between the tags. We could call that, ‘raw text’ and the entire statement, ‘plain text’ but don’t get caught up in the semantics. Text is text, character data.

1 Like

You are pretty knowledgeable! Thank you so much! :open_mouth:

Side note: I love getting caught up in the semantics because in a sense I learn more, especially technical vocabulary. :slight_smile:

1 Like