Where HTML beats C and Java
You take great care when buying an app. To make sure it's good, doesn't ruin your phone and does exactly what you want.
HTML is the ultimate example of what you get when you're promiscuous. You are promiscuous why? Because part of what HTML does is that you have to visit other people's website and you have to execute other people's code
HTML is an interpreted language, but the most remarkable thing about HTML is that it seems to tolerate your mistakes, and if you've used any other programming language be it C or python or javascript you know they won't tolerate your mistakes. They won't interpret for you or compile a program for you unless it's correct.
So what exactly makes HTML so tolerant?
HTML is a markup language, it uses tags to render these markups to a browser. If you, therefore, write some terrible markup like not closing a tag or not properly nesting elements, HTML will seek to solve these inadequacies by imposing its standards on your code. It will close any unclosed tags and nest your elements properly
So why aren't other languages this tolerant?
For anyone who has written a program, you know that no programming language will try and mend your code for you. So why are things so complicated?
Well let's look at an example
loop(10) {
// Code to be executed
printf('Hello World');
}
loop(10) {
// Code to be executed
printf('Goodmorning jack');
}
There are two code blocks in the program above which will be run sequentially
The code above will print "Hello world" 10 times, then proceed to print "Goodmorning jack" 10 times below.
Now let's look at a nested iteration
loop(10) {
// Code to be executed
printf('Hello World');
loop(10) {
// Code to be executed
printf('Goodmorning jack');
}
}
This program's main code block has a nested code block in it.
Now the code above will print 1 "Hello world" then proceed to print "Goodmorning jack" 10 times before printing another "Hello world" and the loop goes on.
So if like in the example below, you do not close the first code block, the programming language can not decide if you want to run the program sequentially or as a nested program, which will result in an error.
loop(10) {
// Code to be executed
printf('Hello World');
// Missing curly brackets to close code block
loop(10) {
// Code to be executed
printf('Goodmorning jack');
}
// System will throw an error
So the answer to why these languages are so much more complicated is that you can do more with them and you'll want to do more.
So the major reason HTML can be so tolerant is that it is so much simpler than other programming languages. It is not built to support deeply nested hierarchy constructs
Although it seems to be tolerant and correcting your program, HTML isn't doing the impossible, it is imposing a model and hoping that the visual effect of what it does is as stunning that you won't notice that it has not done what you hoped it would do.