I decided to start a blog (mostly on things related to software engineering and programming), if only because it helps me gather my thoughts, and improve my understanding of technical concepts. I’ve always felt that trying to explain or teach concepts to other people forces me to grapple with my own understanding of the subject, so here we go. Also Jake Taylor and Steve Yegge told me to.
In honor of my “hello world” blog post, I thought I’d list how to print “hello world” to the console in a few different languages. (I’m not saying that my love of a programming language is inversely proportional to how many characters it takes to print “hello world”, but I’m not NOT saying that either.) (This is probably related to how well a programming language adheres to the principle of “progressive disclosure of complexity,” but more on that in a future blog post.) (Maybe.)
1
2
| # Python
print("hello world")
|
1
2
| // Swift
print("hello world")
|
1
2
| // JavaScript
console.log("hello world");
|
1
2
| # R
cat("hello world\n")
|
1
2
| (* Ocaml *)
print_string "hello world\n";;
|
1
2
3
4
| // Rust
fn main() {
println!("hello world");
}
|
1
2
3
4
5
6
7
8
9
| // C++
#include <iostream>
using namespace std;
int main() {
cout << "hello world" << endl;
return 0;
}
|
1
2
3
4
5
| // Java
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
|