Skip to content

Hello, World!

Get started in as many languages as possible

In this blog post, I wanted to write che classical Hello, World! getting started code in as many languages as possible.

Compiled languages (what happens before you run):

  1. the entire code is translated into machine language before execution,
  2. a file it generates (like .exe) so that you can run it directly,
  3. you get all your errors upfront during the build,
  4. once compiled, the code runs fast.

Interpreted languages (what happens while you run):

  1. code is translated line by line during execution,
  2. no separate build (or .exe), just write and run,
  3. errors show up only when the code hits that specific line,
  4. super useful for scripting and quick tests.
ParadigmType
OOP and proceduralcompiled
hello.ino
void setup() {
Serial.begin(9600);
Serial.println("Hello, World");
}
void loop() {}
ParadigmType
proceduralcompiled
hello.c
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
ParadigmType
OOP and proceduralcompiled
hello.cpp
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
ParadigmType
OOPcompiled
hello.cs
Console.WriteLine("Hello, World!");
ParadigmType
OOP and proceduralcompiled
hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
ParadigmType
OOPinterpreted
Hello.java
package com.hello;
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
ParadigmType
proceduralinterpreted or just-in-time compiled

Just-In-Time Compilation (JIT) is a compilation process in which code is translated from a higher-level language into machine code at runtime.

hello.js
console.log("Hello, World!");
ParadigmType
procedural and multiple dispatchiterpreted or just-in-time compiled

Multiple dispatch or multimethod): a function/method can be dynamically dispatched based on the run-time (dynamic) type or some other attribute of more than one of its arguments.

hello.jl
print("Hello, World!")
ParadigmType
OO and proceduralinterpreted

Kotlin mainly targets the JVM (Java Virtual Machine), but also compiles to JavaScript or native code via LLVM (for native iOS apps sharing business logic with Android app).

hello.kt
fun main() {
print("Hello, World!")
}
ParadigmType
OOP and proceduralinterpreted
hello.py
if __name__ == '__main__':
print("Hello, World!")
ParadigmType
OOP and proceduralcompiled
hello.rs
// https://doc.rust-lang.org/rust-by-example/hello.html
fn main() {
// statements here are executed when the compiled binary is called
// print text to the console
println!("Hello World!");
}