A “Hello world” program is known as the most basic program one can create in any programming language. In this post, I’m going to show you how to create a “Hello world” program in Python, JavaScript and Ruby.

The next installment will be the “Hello world” program in C++ and Go.

Python

Python is an interpreted language, which means all we need to write a program in it is to download the lanugage and start up the interpreter.

We’ll be using the Python interpreter in interactive mode, which means we’ll be writing a single statement and the interpreter will be executing only that line.

First download Python3: Scroll to the bottom and Click on your operating system

Once it has installed, the folder name should be something like “Python 3.7” Now locate the program called IDLE within that folder and open it.

This should open the Python 3.7.3 Shell.

We start writing Python scripts after the > > > prompt.

Type the following:

>>> print("Hello world")

And press enter.

The string Hello world should have printed out.

Congratulations! You coded your first program in Python.

Ruby

You may already have Ruby installed on your computer. Depending on which operating system you’re using, open your terminal emulator to check:

  • macOS: open your Terminal application
  • Linux: open up a shell
  • Windows: open Command Prompt

And type which Ruby If it gives you a path name such as /usr/bin/ruby, that means you already have Ruby installed. If it doesn’t, that means you have to install Ruby

Now that we’ve confirmed we have Ruby, we can use IRB which stands for Interactive Ruby, similar to Python’s IDLE.

For macOS and Linux users, simply type irb into your Terminal or shell. For Windows users, open Interactive Ruby from the Ruby section of your Start Menu.

Now type:

puts "Hello world"

puts is just like Python’s print() statement.

Congratulations! You’ve written your first program in Ruby!

JavaScript

JavaScript, similarly to Python and Ruby, as an interpreter called Node. We can download node here

Open your operating system’s terminal emulator and type node

This should look familiar!

Now type:

console.log("Hello world")

It should print Hello world to the console.

Congratulations, you’ve written your first program in JavaScript using Node!

BUT LET'S NOT STOP THERE!

Since JavaScript is a browser-based language, that is, it is interpreted by every web browser in existence, we can print Hello world directly to our browser.

For this, download Chrome if you don’t already have it.

Once you open the Chrome browser, right-click on the browser window and choose Inspect from the dropdown menu.

A window should open up. Now, at the top of that window you should see an Elements tab and a Console tab. Click the Console tab.

Does this look familiar at all? After the > start writing your JavaScript:

console.log("Hello world")

And press enter.

You should see Hello world printed to that Console.

But, there’s a cooler thing we could do!

Try typing this:

document.write("Hello world")

Press enter, and check out the browser page. It should be a blank page with Hello world on it!

You just manipulated the DOM (Document Object Model) with JavaScript using the JS Console. Congratulations!

Happy coding!

E


Got Questions❓, Comments 🗣 or Edits ✍

Use the Twitter thread below and hashtag #E4Everything to get in touch with me regarding this blog post:

Previous: Vocabulary ContinuedNext: Hello world Continued