When I start learning any programming language, the first example I get from the tutorial is : let's print "Hello World!".
This exercise in every tutorial is considered to be one of the simplest programs possible in almost all languages.
In this article, you'll learn how to write the "Hello, World!" program in the top 20 most popular programming languages.
01. "Hello World" Program in JavaScript
Of course I would start from a language which I know already.
<script>
console.log('Hello, World!');
</script>
02. "Hello World" Program in Python
Python is also one of the most popular programming languages. It's used for software development, system scripting, web development
print("Hello, World!")
03. "Hello World" Program in Java
Java is a high-level, class-based, and object-oriented programming language.
class HelloWorld {
public static void main(String args[]) {
System.out.println("Hello, World!");
}
}
04. "Hello World" Program in Kotlin
Kotlin is primarily used for android development.
fun main(args: Array<String>) {
println("Hello, World!")
}
05. "Hello World" Program in PHP
PHP is an a scripting language, It's used to develop websites and web apps.
<!DOCTYPE html>
<html>
<head>
<title> </title>
</head>
<body>
<?php
echo "Hello, World!";
?>
</body>
</html>
06. "Hello World" Program in "C#"
C# is used to develop desktop applications, web applications, and web services. It's also used in game development.
namespace HelloWorld
{
class Hello {
static void Main(string[] args)
{
System.Console.WriteLine("Hello, World!");
}
}
}
07. "Hello World" Program in Swift
Swift was created by Apple in 2014. It's a general-purpose programming language for the Apple ecosystem.
print("Hello, World!")
08. "Hello World" Program in C++
C++ is a general-purpose object-oriented programming language created by Bjarne Stroustrup. It's widely used to develop operating systems, browsers, games, etc.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!";
return 0;
}
09. "Hello World" Program in C
C is used to develop software like operating systems, databases, compilers, etc.
#include <stdio.h>
int main()
{
printf("Hello, World!");
return 0;
}
10. "Hello World" Program in Matlab
MATLAB is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks.
disp('Hello, World!');
11. "Hello World" Program in R
R is a programming language and free software environment for statistical computing and graphics supported by the R Core Team and the R Foundation for Statistical Computing.
cat('Hello, World!')
12. "Hello World" Program in Rub
Ruby is an interpreted, high-level, general-purpose programming language.
cat('Hello, World!')
13. "Hello World" Program in Rust
Rust is an open-source systems programming language that focuses on speed, memory safety and parallelism. Developers are using Rust to create a wide range of new software applications, such as game engines, operating systems, file systems, browser components and simulation engines for virtual reality.
fn main() {
println!("Hello, World!");
}
14. "Hello World" Program in TypeScript
TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language.
let message: string = 'Hello, World!';
console.log(message);
15. "Hello World" Program in Perl
Perl is a general-purpose coding language used for text manipulation, system administration, web development, network programming, GUI development, etc.
#!/usr/bin/perl
use strict;
use warnings;
print("Hello, World!");
16. "Hello World" Program in Scala
Scala is a high-level language that combines the features of object-oriented and functional programming in one language.
object Hello {
def main(args: Array[String]) = {
println("Hello, World!")
}
}
17. "Hello World" Program in Dart
Dart is a general-purpose, object-oriented, class-based, garbage-collected language with C-style syntax. It was created by Google in 2011
void main() {
print('Hello, World!');
}
18. "Hello World" Program in Solidity
Solidity is an object-oriented programming language for writing smart contracts. It is used for implementing smart contracts on various blockchain platforms, most notably, Ethereum.
pragma solidity ^0.4.22;
contract helloWorld {
function renderHelloWorld () public pure returns (string) {
return 'Hello, World!';
}
}
19. "Hello World" Program in Go
Go is a statically typed, compiled programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson.
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
20. "Hello World" Program in Julia
Julia is a high-performance, high-level, open-source, dynamically-typed programming language. Julia was created by combining the powerful features of other programming languages like C, Ruby, Lisp, Matlab, Python, R, and Perl.
println("Hello, World!")
Top comments (11)
Frankly we have to come up with a better intro program than "Hello World".
Long gone are the days when printing something on the terminal meant something or was exciting.
Today's basic program should be something like draw a square on the screen. Then we shift the focus towards terminal programing to something more real for this era like the browser, a window, a mobile app, or a something else. Even on the terminal it's possible.
Here's a box in logo:
repeat 4 [ fd 100 rt 90 ]
I wish you would include "Hello World" in Assembly language, esp for Intel 8086 family or Motorola. :)
The 1st programming language that gave me money would output the same result with the following :
@2, 10 say "Hello World"
:)
Sadly, now that language is extinct, like the then loved language which would produce the same result with :
Begin
writeLn("Hello World");
End
In stead of printing "Hello World", I write like the following :
package main
import "fmt"
func main() {
fmt.Println("I am learning Go aka Golang")
}
That is what I do with other programming language like Dart with Flutter or React Native.
Why #15, #16 both Perl??
I fixed that , thank you for your feedback :)
Transcript show: "Hello world!".
You've forgotten the "#" on the title of the number 6 ;)
And on the number 19 it should be "Go" in the title :)
I fixed that , thank you for your feedback :)
Typo number 12 word Ruby
I think for Ruby in #12 should be:
print "Hello, World!"
:)