Hello world explained | First interactive program for programming beginners (Part 1)
text
Writing Our First Program: Hello World
Venturing into the world of programming? You've probably heard about the Hello World program. Today, we will walk through how to write this simple program in three different Command Line Interfaces (CLIs).
Here's what we'll be covering:
- Basics of code and data
- Writing Hello World in PowerShell
- Writing Hello World in JavaScript
- Writing Hello World in the Linux terminal
Code and Data: The Essence of a Program
As we glimpsed in a previous video on computer programming, every program consists of two fundamental entities: code and data. We can't generalize this concept to every program out there by just showing one example, but you'll soon see some evidence supporting this idea.
Writing Hello World in Different CLIs
For demonstration purposes, we have selected three CLIs: PowerShell, JavaScript console, and Linux terminal. Each CLI uses a specific programming language for scripting. Let's examine these versions of the Hello World program.
# PowerShell
Write-Host "Hello World";
// JavaScript
console.log("Hello World");
# Linux terminal
echo "Hello World"
What Do These Programs Do?
You might be wondering what these simple programs actually do. They display the text "Hello World" in the console. But why is this significant? Hang tight; there's a deeper meaning.
Verb-Noun Combinations in Code
As we dive deeper into programming, we'll notice a recurring theme: verb-noun combinations. Verbs inform us about the action being taken, while nouns provide context. Take console.log
as an example. Here, log is the verb, and console is the noun.
In the PowerShell example, Write
is the verb, and Host
is the noun. In the Linux terminal example, echo
is the verb, and the noun is implied by the context which is the CLI itself.
Why Hello World Matters
The Hello World program is more than just a trivial exercise. It demonstrates a fundamental concept: how programs communicate with the outside world. The Hello World program show us how we can allow our programs to give us feedback about what is happening inside the program.
So, when you're ready to take the next step, remember: even a simple Hello World is a doorway into the vast world of programming.
quiz
resources
updates
Committed by on