Hello, World!
Get started in as many languages as possible
Introduction & Glossary
Section titled “Introduction & Glossary”In this blog post, I wanted to write che classical Hello, World! getting started code in as many languages as possible.
Compiled V.S. Interpreted
Section titled “Compiled V.S. Interpreted”Compiled languages (what happens before you run):
- the entire code is translated into machine language before execution,
- a file it generates (like
.exe) so that you can run it directly, - you get all your errors upfront during the build,
- once compiled, the code runs fast.
Interpreted languages (what happens while you run):
- code is translated line by line during execution,
- no separate build (or
.exe), just write and run, - errors show up only when the code hits that specific line,
- super useful for scripting and quick tests.
Arduino
Section titled “Arduino”| Paradigm | Type | |:------------------:|:--------:| | OOP and procedural | compiled |
void setup() { Serial.begin(9600); Serial.println("Hello, World");}
void loop() {}| Paradigm | Type | |:----------:|:--------:| | procedural | compiled |
#include <stdio.h>
int main() { printf("Hello, World!\n"); return 0;}| Paradigm | Type | |:------------------:|:--------:| | OOP and procedural | compiled |
#include <iostream>
int main() { std::cout << "Hello, World!" << std::endl; return 0;}| Paradigm | Type | |:--------:|:--------:| | OOP | compiled |
Console.WriteLine("Hello, World!");| Paradigm | Type | |:------------------:|:--------:| | OOP and procedural | compiled |
package main
import "fmt"
func main() { fmt.Println("Hello, World!")}| Paradigm | Type | |:--------:|:-----------:| | OOP | interpreted |
package com.hello;
public class Hello { public static void main(String[] args) { System.out.println("Hello, World!"); }}JavaScript
Section titled “JavaScript”| Paradigm | Type | |:----------:|:--------------------------------------:| | procedural | interpreted 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.
console.log("Hello, World!");| Paradigm | Type | |:--------------------------------:|:--------------------------------------:| | procedural and multiple dispatch | interpreted 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.
print("Hello, World!")Kotlin
Section titled “Kotlin”| Paradigm | Type | |:------------------:|:-----------:| | OOP and procedural | interpreted |
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).
fun main() { print("Hello, World!")}Python
Section titled “Python”| Paradigm | Type | |:------------------:|:-----------:| | OOP and procedural | interpreted |
if __name__ == '__main__': print("Hello, World!")| Paradigm | Type | |:------------------:|:--------:| | OOP and procedural | compiled |
// https://doc.rust-lang.org/rust-by-example/hello.htmlfn main() { // statements here are executed when the compiled binary is called
// print text to the console println!("Hello World!");}