Programming is a fascinating journey and it all starts with printing "Hello, World!" on the screen. This simple program is the first step for many into the world of coding. Let's explore how to write this program in various programming languages, starting from the easiest to the more complex ones.
The Easy Ones
Ruby
Ruby is known for its simplicity and readability. Here's how you can print "Hello, World!" in Ruby:
puts "Hello World!"
Python
Python is another language famous for its simplicity. Here's the Python version:
print("Hello World!")
JavaScript
JavaScript, the language of the web, also makes it easy:
console.log("Hello World!");
Intermediate Languages
Swift
Swift, Apple's language for iOS development, has a straightforward syntax:
import Swift
print("Hello, World!")
PHP
PHP, a popular language for web development, requires a bit more code:
<?php
echo "Hello World!";
?>
Kotlin
Kotlin, a statically typed language from JetBrains, is gaining popularity for Android development:
fun main(args : Array<String>) {
println("Hello, World!")
}
The Hard Ones
C
C is a powerful language that provides low-level access to memory and is widely used in system programming:
#include<stdio.h>
int main()
{
printf("Hello World!");
}
C++
C++, an extension of C with additional features like classes and objects, is used in game development and system software:
#include <iostream>
int main()
{
std::cout << "Hello World!";
return 0;
}
LISP
LISP (LISt Processing) is one of the oldest high-level programming languages and has a unique syntax:
(defun hello-world ()
(format t "Hello World"))
(hello-world)
Java
Java, a class-based object-oriented language, is widely used in enterprise environments:
class HelloWorld{
public static void main(String[] args){
System.out.println("Hello World!");
}
}
C
C#, a language developed by Microsoft, is primarily used in Windows desktop applications and game development with Unity:
using System;
namespace HelloWorldApp {
class Program {
static void Main(string[] args) {
Console.WriteLine("Hello World!");
}
}
}
No matter which language you choose, writing your first "Hello, World!" program is an exciting milestone. Happy coding!
Top comments (5)
Nice!! This is really cool seeing all these variations on the classic hello world. Fun post, Prakriti! đ
Thanks! đ
I use to learn one or more languages per day and write the same financial mathematics solution using Bisection Method of Numerical Calculus. Repository todos_juros, user jacknpoe. I have in every language of the post.
Rust is also very nice with this:
@10, 25 say "Hello World"
The programming language from which I earned my money for the 1st time is the one that has this syntax.