Since the last week, I was scratching my head to figure out what post can I write in dev? I wanted it to be meaningful so that it can be useful for the readers. Then, I thought, if I can't write anything meaningful then I should write something absolutely meaningless. And here I am. Printing "Hello, World!" in 30 different languages(in no particular order). ENJOY!
[Spoiler alert: The last one is special!]
1. C
#include <stdio.h>
int main(void){
printf("Hello, world!\n");
return 0;
}
2. C++
#include <iostream>
int main(){
std::cout << "Hello, World!\n";
}
3. C'#'
class HelloWorldApp{
static void Main(){
System.Console.WriteLine("Hello, world!");
}
}
4. Python
print("Hello, world!")
5. Java
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello, world!");
}
}
6. JavaScript
document.writeln('Hello, World!');
7. TypeScript
console.log("Hello, World!");
8. R
cat("Hello, World!")
9. Rust
fn main() {
println!("Hello, World!");
}
10. Go Lang
package main
func main() {
println("Hello, World!")
}
11. Lua
print("Hello, World")
12. Perl
use strict;
use warnings;
print("Hello, World!");
13. Haskell
putStrLn "Hello world"
14. Bash
echo 'Hello, world!'
15. Kotlin
fun main() {
println("Hello, World!")
}
16. Ruby
puts "Hello, World!"
18. Swift
import Swift
print("Hello, World!")
19. Julia
println("Hello, World!")
20. Dart
void main() {
print('Hello, World!');
}
21. Elixir
IO.puts("Hello, World!")
22. Groovy
println "Hello, World!"
23. Scala
object dev
{
// Main Method
def main(args: Array[String])
{
// prints Hello World
println("Hello, World!")
}
}
24. Ada
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello, world!");
end Hello;
25. Bosque
namespace NSMain;
entrypoint
function main(): String {
return "Hello, world!";
}
26. BASIC
PRINT "Hello, world!"β
27. Cobol
display "Hello, world!".
28. D
import std.stdio;
void main()
{
writeln("Hello, World!");
}
29. F'#'
open System
[<EntryPoint>]
let main argv =
printfn "Hello, World!"
30. BrainF*ck
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
Why not add a few more in the comment section?
Latest comments (65)
Racket
Beef
Surprised not to see a Hello World in Erlang.
console.log("Hello, World!"); or document.writeln('Hello, World!');
should be the same example in 6 and 7 points.I really miss LOLCODE here.
HAI 1.2
CAN HAS STDIO?
VISIBLE "HELLO WORLD!"
KTHXBYE
LOLCODE is an esoteric programming language inspired by lolspeak, the language expressed in examples of the lolcat Internet meme. The language was created in 2007 by Adam Lindsay, researcher at the Computing Department of Lancaster University.
Shakespeare
PHP
JASS (language used in Warcraft III mods)
Funny
Fair enough.
Now, where are the unit tests?
No one:
Absolute no one:
PHP: echo('hello, world');
:D
Prolog
write('Hello world').