markuparticle

Markup Language vs Programming Language


I was reading a article about it, and there was a line in that article which confused me a bit:

".....the markup language is used to present information whereas programming language is used to give instructions to a computer to perform a particular task."

The Computer still has to follow instructions of markup language to display information on the screen, right?

Please help! And Thank you!


Solution

  • You are right and the article is also right, but there's a bit of clarification.

    A markup language (HTML, XAML, markdown, etc.) is an example of a declarative language, which says "this is what the result should be (e.g. what the screen should look like, what bit of input or output is expected, and so on). Declarative languages do not say anything about how to do something, but ultimately rely on an "engine" that imperatively gets to the results.

    In contrast an imperative language describes each step that must be taken to achieve the end result (i.e. an algorithm). This is a set of instructions.

    The reason your statement, "The Computer still has to follow instructions of markup language to display information on the screen" is correct is because a declarative language must rely on imperative operators and statements such as conditionals, looping, and so on (imperative) at a lower level to achieve the stated declarations.

    Incidentally, referring back to your title... both are programming languages. They're just using different paradigms.