Skip to main content

Is HTML a Programming Language? Pratik Sah The Crazy Programmer

When we talk about a programming language, we can say them as a medium to communicate with the computer. To express ourselves, we as humans talk with each other using any of our native languages but we cannot simply communicate with the computer the same way.

It simply can’t understand our native language. Instead, we need a translator who can translate our language into a computer’s language.

Now, before talking about the translator, I want to talk about the topic of today’s post, i.e. is HTML a programming language?

HTML is a declarative programming language. What does that mean? Well, a declarative programming language is a paradigm that only states what the result should look like and not hot to achieve it. We use basic statements for achieving something we want. Here we use constraints to describe a user interface.

User Interface

This is how we use constraints for creating a UI using HTML.

<!DOCTYPE html>
<html>
  <head>
    <title>Page Title</title>
  </head>
  <body>
    <h1>This is a Heading</h1>
    <p>This is a paragraph.</p>
  </body>
</html>

These constraints are going to describe the structure of our UI. Here the h1 is going to be a heading of our UI and the p is going to be the paragraph of our UI. The HTML parser or the HTML engine of the browser is going to render the UI from the above constraints. Here, we haven’t described how to achieve our desired UI.

Whereas in other programming languages, we have to teach a computer how to achieve a particular result. For example, if we want to make a simple calculator, we need to show the computer how to do that.

a = int(input('Enter number'))
b = int(input('Enter number'))

c = a + b

print ('Sum of a and b is: {0}'.format(c))

All these programming logic can’t be implemented using HTML and can only be achieved when we use Javascript, a type of programming language for the web.

So, how to implement the same logic using HTML and JS? Let’s see.

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Add two numbers</title>
    </head>
    <body>
        <input type="number" name="first_num" id="x" placeholder="Enter first number"/>
        <br />
        <input type="number" name="second_num" id="y" placeholder="Enter second number"/>
        <br />
        <button id="go">Calculate</button>
        
        <div id="result"></div>
        
        <script>
            "use strict";
            function add() {
                var x = Number(document.getElementById('x').value);
                var y = Number(document.getElementById('y').value);
            
                document.getElementById('result').innerHTML = x+y;
                return false;
            }
            
            document.getElementById('go').addEventListener('click', add);
        </script>
    </body>
</html>

This states that we can’t implement programming logic in HTML but we can achieve that using Javascript.

Now, I hope you get what I’m trying to say for HTML.

Well, this was all about today’s topic and points related to it. If you stuck into any kind of confusion, don’t forget to google it and try to solve it on your own. This will teach you how to learn on your own as someone might have faced a similar problem earlier.

Still, if you still don’t find any solution for your problem, you can ask your doubt in the comment’s section below and we’ll get back to you🤓. Till then enjoy your code. See you in my next post. Bye✌!

The post Is HTML a Programming Language? appeared first on The Crazy Programmer.



from The Crazy Programmer https://ift.tt/3e2vyj5

Comments

Popular posts from this blog

Difference between Web Designer and Web Developer Neeraj Mishra The Crazy Programmer

Have you ever wondered about the distinctions between web developers’ and web designers’ duties and obligations? You’re not alone! Many people have trouble distinguishing between these two. Although they collaborate to publish new websites on the internet, web developers and web designers play very different roles. To put these job possibilities into perspective, consider the construction of a house. To create a vision for the house, including the visual components, the space planning and layout, the materials, and the overall appearance and sense of the space, you need an architect. That said, to translate an idea into a building, you need construction professionals to take those architectural drawings and put them into practice. Image Source In a similar vein, web development and design work together to create websites. Let’s examine the major responsibilities and distinctions between web developers and web designers. Let’s get going, shall we? What Does a Web Designer Do?

A guide to data integration tools

CData Software is a leader in data access and connectivity solutions. It specializes in the development of data drivers and data access technologies for real-time access to online or on-premise applications, databases and web APIs. The company is focused on bringing data connectivity capabilities natively into tools organizations already use. It also features ETL/ELT solutions, enterprise connectors, and data visualization. Matillion ’s data transformation software empowers customers to extract data from a wide number of sources, load it into their chosen cloud data warehouse (CDW) and transform that data from its siloed source state, into analytics-ready insights – prepared for advanced analytics, machine learning, and artificial intelligence use cases. Only Matillion is purpose-built for Snowflake, Amazon Redshift, Google BigQuery, and Microsoft Azure, enabling businesses to achieve new levels of simplicity, speed, scale, and savings. Trusted by companies of all sizes to meet

2022: The year of hybrid work

Remote work was once considered a luxury to many, but in 2020, it became a necessity for a large portion of the workforce, as the scary and unknown COVID-19 virus sickened and even took the lives of so many people around the world.  Some workers were able to thrive in a remote setting, while others felt isolated and struggled to keep up a balance between their work and home lives. Last year saw the availability of life-saving vaccines, so companies were able to start having the conversation about what to do next. Should they keep everyone remote? Should they go back to working in the office full time? Or should they do something in between? Enter hybrid work, which offers a mix of the two. A Fall 2021 study conducted by Google revealed that over 75% of survey respondents expect hybrid work to become a standard practice within their organization within the next three years.  Thus, two years after the world abruptly shifted to widespread adoption of remote work, we are declaring 20