If you’ve ever wondered about the magical world of programming languages, you’ve probably encountered a special and friendly phrase – “Hello World.” Don’t be fooled by its simplicity; this little phrase holds the key to the exciting universe of coding!
In this article, we’re going to explore the “Hello World” program in 40 different programming languages. We’ll uncover how each language greets the computer in its own unique way.
1. C++
C++ is a powerful and versatile programming language widely used for various applications, including system software, game development, and high-performance applications.
Features of C++
- Object-Oriented: Supports classes and objects for efficient and organized code structuring.
- High Performance: Allows low-level memory manipulation and direct hardware access.
- Standard Library: Offers a rich set of pre-built functions and data structures.
C++ “Hello World” Program
#include <iostream> int main() { std::cout << "Hello World!" << std::endl; return 0; }
2. JavaScript
JavaScript is a versatile and widely used programming language that primarily runs in web browsers, making it an essential tool for web development and creating interactive web applications.
Features of JavaScript
- Lightweight: Being a client-side language, it requires minimal resources to run on users’ browsers.
- Cross-platform: Works on various operating systems and devices, ensuring wide compatibility.
- Event-driven: Utilizes event listeners to respond to user actions, enabling dynamic and responsive web pages.
JavaScript “Hello World” Program
console.log("Hello World!");
3. C
C is a widely used and foundational programming language known for its efficiency and portability, making it a popular choice for system-level programming and embedded systems.
Features of C
- Procedural: Follows a procedural programming paradigm, allowing code to be organized into functions.
- Low-level Access: Provides direct memory manipulation and access to hardware, making it suitable for system-level tasks.
- Portable: Code written in C can be easily ported across different platforms with minimal modifications.
C “Hello World” Program
#include <stdio.h> int main() { printf("Hello World!\n"); return 0; }
4. Python
Python is an elegant and high-level programming language admired for its simplicity and readability, making it ideal for beginners and experienced developers alike.
Features of Python
- Easy to Learn: The syntax is straightforward and intuitive, enabling developers to write code with fewer lines.
- Interpreted: Python does not require compilation, allowing quick development and easy debugging.
- Rich Standard Library: Comes with a vast collection of modules and libraries, easing the implementation of various functionalities.
Python “Hello World” Program
print("Hello World!")
5. Java
Java is a robust and widely-used object-oriented programming language recognized for its “write once, run anywhere” capability, making it suitable for cross-platform development.
Features of Java
- Object-Oriented: Emphasizes classes and objects, enabling modular and reusable code.
- Platform Independence: Code written in Java is compiled into an intermediate form (bytecode), which can be executed on any platform with the Java Virtual Machine (JVM).
- Automatic Memory Management: Java uses a garbage collector to manage memory, reducing developers’ burden.
Java “Hello World” Program
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
6. C#
C# (pronounced as C sharp) is a powerful and modern object-oriented programming language developed by Microsoft, widely used for building Windows applications and web services.
Features of C#
- Object-Oriented: Supports classes and objects, promoting code organization and reusability.
- Type-Safe: Enforces strong typing, reducing runtime errors and enhancing code reliability.
- Integrated Development Environment (IDE) Support: C# is well-integrated with Microsoft Visual Studio, providing a comprehensive development environment.
C# “Hello World” Program
using System; class Program { static void Main() { Console.WriteLine("Hello World!"); } }
7. TypeScript
TypeScript is a superset of JavaScript, adding static typing to the language and providing enhanced tooling and features for large-scale JavaScript applications.
Features of TypeScript
- Static Typing: Allows developers to define variable types during development, catching type-related errors early.
- Object-Oriented: Supports classes, interfaces, and inheritance, facilitating object-oriented programming practices.
- Compiler Support: TypeScript code is transpiled to plain JavaScript, ensuring compatibility with all modern browsers.
TypeScript “Hello World” Program
console.log("Hello World!");
8. PHP
PHP is a popular server-side scripting language primarily used for web development, known for its ease of use and seamless integration with HTML.
Features of PHP
- Server-Side Scripting: Executes on the server, generating dynamic web content before sending it to the client’s browser.
- Cross-Platform: Compatible with various operating systems, making it highly versatile.
- Rich Web Development Ecosystem: Offers multiple frameworks and libraries, simplifying web development tasks.
PHP “Hello World” Program
<?php echo "Hello World!"; ?>
9. Swift
Swift is a modern and powerful programming language developed by Apple, designed to build iOS, macOS, watchOS, and tvOS applications.
Features of Swift
- Fast and Safe: Swift is optimized for performance and designed with safety in mind, preventing common programming errors.
- Expressive Syntax: Offers a concise and expressive syntax, making code more readable and maintainable.
- Swift Playgrounds: Includes an interactive development environment called Swift Playgrounds for experimenting and learning Swift.
Swift “Hello World” Program
import Foundation print("Hello World!")
10. Ruby
Ruby is a dynamic and elegant object-oriented programming language admired for its simplicity and productivity, often used for web development and automation tasks.
Features of Ruby
- Concise Syntax: Ruby’s syntax is designed to be intuitive and human-friendly, reducing the need for boilerplate code.
- Dynamic Typing: Allows variables to change types at runtime, providing flexibility in coding.
- Rails Framework: Ruby on Rails, a powerful web framework built on Ruby, streamlines web application development.
Ruby “Hello World” Program
puts "Hello World!"
11. Go
Go, commonly referred to as Golang, is a modern and statically-typed programming language developed by Google, renowned for its efficiency and simplicity.
Features of Go (Golang)
- Concurrency Support: Built-in support for lightweight concurrent programming with goroutines and channels.
- Fast Compilation: Go’s compiler produces efficient machine code, resulting in quick program execution.
- Garbage Collection: Go automatically handles memory management with its garbage collector, reducing developer overhead.
Go “Hello World” Program
package main import "fmt" func main() { fmt.Println("Hello World!") }
12. Rust
Rust is a systems programming language focusing on safety, performance, and concurrency, empowering developers to build reliable and efficient software.
Features of Rust
- Memory Safety: Rust’s ownership system and borrow checker prevents common memory-related bugs like null pointers and data races.
- Concurrency without Data Races: Rust ensures safe concurrent programming through ownership and borrowing.
- Zero-cost Abstractions: Rust allows high-level abstractions without compromising runtime performance.
Rust “Hello World” Program
fn main() { println!("Hello World!"); }
13. Kotlin
Kotlin is a modern and expressive programming language that runs on the Java Virtual Machine (JVM) and is fully interoperable with Java, making it a popular choice for Android app development.
Features of Kotlin
- Concise Syntax: Kotlin reduces boilerplate code, making it more concise and readable than Java.
- Null Safety: Kotlin’s type system includes null safety features to prevent null pointer exceptions.
- Extension Functions: Kotlin allows adding new functions to existing classes without modifying their source code.
Kotlin “Hello World” Program
fun main() { println("Hello World!") }
14. Objective-C
Objective-C is a superset of the C programming language, used primarily for macOS and iOS app development, and it was the main programming language for Apple platforms before the introduction of Swift.
Features of Objective-C
- Message Passing: Uses a messaging syntax for method invocation on objects, allowing dynamic dispatch.
- Runtime Reflection: Supports runtime introspection and dynamic class loading, making it highly dynamic.
- Cocoa Framework: Objective-C works seamlessly with Apple’s Cocoa framework, enabling easy development of macOS and iOS applications.
Objective-C “Hello World” Program
#import <Foundation/Foundation.h> int main() { @autoreleasepool { NSLog(@"Hello World!"); } return 0; }
15. Dart
Dart is a modern, open-source programming language developed by Google, known for its performance, flexibility, and popularity as the primary language for building applications using the Flutter framework.
Features of Dart
- Just-in-Time (JIT) and Ahead-of-Time (AOT) Compilation: Allows fast development and efficient production-ready code.
- Strongly Typed: Offers static typing, ensuring more robust and reliable code.
- Hot Reload: Dart’s hot reload feature lets developers quickly see changes during development without restarting the application.
Dart “Hello World” Program
void main() { print('Hello World!'); }
16. Shell scripting (Bash)
Shell scripting, specifically Bash (Bourne Again SHell), is a scripting language used in Unix-based operating systems to automate tasks and execute commands directly in the shell.
Features of Bash Scripting
- Command Execution: Bash scripts allow users to execute shell commands and programs sequentially or conditionally.
- Variables and Environment: Supports variables to store and manipulate data and environment variables to control the shell’s behavior.
- Control Flow: Offers conditional statements (if-else), loops (for, while), and functions to control the flow of the script.
Bash “Hello World” Script
#!/bin/bash echo "Hello World!"
17. MATLAB
MATLAB is a high-level programming language primarily used for numerical computation, data analysis, and visualization.
Features of MATLAB
- Matrix Operations: MATLAB’s core strength lies in its ability to efficiently perform matrix and array operations.
- Extensive Library: Comes with a vast collection of built-in functions and toolboxes for various scientific and engineering tasks.
- Plotting and Visualization: Provides powerful tools for creating interactive 2D and 3D plots and visualizations.
MATLAB “Hello World” Program
fprintf('Hello World!\n');
18. Perl
Perl is a flexible and powerful scripting language, well-known for its text-processing capabilities and used for a wide range of tasks, including system administration, web development, and bioinformatics.
Features of Perl
- Regular Expressions: Perl has strong support for regular expressions, making it adept at text parsing and manipulation.
- Practical and Versatile: Designed to be practical and expressive, allowing developers to write concise code for various tasks.
- CPAN: Comprehensive Perl Archive Network (CPAN) provides a vast repository of libraries and modules for easy code reuse.
Perl “Hello World” Program
print "Hello World!\n";
19. Scala
Scala is a modern and multi-paradigm programming language that runs on the Java Virtual Machine (JVM), combining object-oriented and functional programming concepts.
Features of Scala
- Concise Syntax: Scala’s concise syntax and type inference make code more expressive and less verbose.
- Immutable Data Structures: Emphasizes immutability, which helps in writing safer and more concurrent code.
- Higher-Order Functions: Supports higher-order functions, enabling powerful functional programming capabilities.
Scala “Hello World” Program
object HelloWorld { def main(args: Array[String]): Unit = { println("Hello World!") } }
20. Lua
Lua is a lightweight and fast scripting language designed to be embedded within other applications to provide scripting capabilities and extend their functionality.
Features of Lua
- Lightweight: Lua has a small footprint and low memory requirements, making it suitable for resource-constrained environments.
- Easy Integration: Designed to be easily integrated into other applications as a scripting language.
- Extensible: Allows developers to extend the language by creating custom C/C++ libraries.
Lua “Hello World” Program
print("Hello World!")
21. Groovy
Groovy is a dynamic and powerful scripting language that runs on the Java Virtual Machine (JVM) and is fully interoperable with Java, making it an excellent choice for scripting tasks and enhancing Java applications.
Features of Groovy
- Dynamic Typing: Groovy is dynamically typed, allowing more flexible and concise code compared to Java.
- Closures: Supports closures, enabling developers to write more expressive and functional-style code.
- Scripting Capabilities: Groovy’s concise syntax and scripting features make it well-suited for automation and rapid prototyping tasks.
Groovy “Hello World” Program
println "Hello World!"
22. Haskell
Haskell is a purely functional programming language, emphasizing immutability, declarative style, and strong type systems.
Features of Haskell
- Purely Functional: Haskell avoids mutable states and side effects, promoting a more predictable and maintainable codebase.
- Lazy Evaluation: Haskell uses lazy evaluation, which means expressions are only evaluated when needed, potentially improving efficiency.
- Powerful Type System: Haskell’s type system is expressive and allows for strong static typing, reducing runtime errors.
Haskell “Hello World” Program
main :: IO () main = putStrLn "Hello World!"
23. R
R is a powerful programming language and environment widely used for statistical computing, data analysis, and graphical representation.
Features of R
- Extensive Package Ecosystem: R has a vast collection of packages and libraries contributed by the community for various data analysis tasks.
- Data Visualization: R offers advanced data visualization capabilities, making creating insightful plots and graphs easy.
- Statistical Functions: R has built-in statistical functions, making it an excellent tool for data analysis and hypothesis testing.
R “Hello World” Program
print("Hello World!")
24. Julia
Julia is a high-level and high-performance programming language designed for numerical and scientific computing, combining the ease of use of dynamic languages with the performance of compiled languages.
Features of Julia
- Just-in-Time (JIT) Compilation: Julia uses JIT compilation to generate optimized machine code for better performance.
- Multiple Dispatch: Supports multiple dispatches, allowing functions to be defined for different combinations of argument types.
- Parallel Computing: Julia has built-in support for parallel computing, making it efficient for handling large-scale data and computations.
Julia “Hello World” Program
println("Hello World!")
25. Assembly Language
Assembly language is a low-level programming language that represents instructions in a human-readable format, which an assembler then translates into machine code.
Features of Assembly Language
- Low-Level Operations: Assembly language instructions closely map to the machine’s architecture and allow direct hardware manipulation.
- Platform-Specific: Assembly language is specific to a particular processor or architecture, requiring different platform versions.
- Efficient Control: Provides fine-grained control over the hardware resources, making it suitable for system-level programming and performance-critical tasks.
Assembly “Hello World” Program (x86 Intel syntax)
section .data hello db 'Hello World!', 0 section .text global _start _start: ; System call number for write (4) mov eax, 4 ; File descriptor for standard output (1) mov ebx, 1 ; Address of the string to write mov ecx, hello ; Length of the string mov edx, 13 ; Invoke the system call to write the string to the standard output int 0x80 ; System call number for exit (1) mov eax, 1 ; Exit code 0 xor ebx, ebx ; Invoke the system call to exit the program int 0x80
26. Visual Basic (VB)
Visual Basic (VB) is an event-driven programming language developed by Microsoft, widely used for building Windows applications and other graphical user interface (GUI) applications.
Features of Visual Basic
- Rapid Application Development (RAD): Visual Basic is known for its easy use and quick application development capabilities.
- Drag-and-Drop Interface: Offers a graphical user interface builder, allowing developers to design forms by dragging and dropping elements.
- Integrated Development Environment (IDE): Visual Basic is integrated with Microsoft Visual Studio, providing a comprehensive development environment.
Visual Basic “Hello World” Program
Module HelloWorld Sub Main() Console.WriteLine("Hello World!") End Sub End Module
27. Delphi
Delphi, also known as Object Pascal, is an object-oriented programming language developed by Borland/Embarcadero. It is commonly used for developing Windows applications and is closely associated with the Delphi Integrated Development Environment (IDE).
Features of Delphi
- Object-Oriented: Delphi follows the principles of object-oriented programming, allowing developers to create reusable and modular code.
- Component-Based Development: Delphi uses a component-based approach, enabling the easy integration of pre-built components to speed up development.
- Cross-Platform Development: With the FireMonkey framework, Delphi supports cross-platform development for Windows, macOS, Android, and iOS.
Delphi “Hello World” Program
program HelloWorld; begin WriteLn('Hello World!'); end.
28. ActionScript
ActionScript is an object-oriented programming language primarily used for developing rich multimedia and interactive content on the Adobe Flash platform.
Features of ActionScript
- Interactivity: ActionScript enables developers to create interactive animations and user interfaces for web applications and games.
- Integration with Flash: ActionScript is closely integrated with Adobe Flash Professional, allowing seamless development of Flash-based content.
- Event Handling: Supports event-driven programming, triggering actions in response to user interactions.
ActionScript “Hello World” Program
package { import flash.display.Sprite; public class HelloWorld extends Sprite { public function HelloWorld() { trace("Hello World!"); } } }
29. COBOL
COBOL (Common Business Oriented Language) is a high-level programming language primarily used for business, finance, and administrative applications.
Features of COBOL
- English-like Syntax: COBOL’s syntax is designed to be easily readable and understandable, resembling natural language.
- Business Data Processing: COBOL is well-suited for handling large volumes of data and performing batch-processing tasks.
- Legacy System Support: COBOL is often used to maintain and modernize existing mainframe applications and systems.
COBOL “Hello World” Program
IDENTIFICATION DIVISION. PROGRAM-ID. HelloWorld. PROCEDURE DIVISION. DISPLAY 'Hello World!'. STOP RUN.
30. Fortran
Fortran (Formula Translation) is one of the oldest high-level programming languages commonly used in scientific, engineering, and numerical computing applications.
Features of Fortran
- Numerical Computation: Fortran’s legacy lies in its powerful support for numerical and scientific calculations.
- Array Operations: Fortran provides efficient array operations, making it suitable for matrix computations and scientific simulations.
- Performance Optimization: Fortran allows developers to write highly optimized code, especially for computationally intensive tasks.
Fortran “Hello World” Program
PROGRAM HelloWorld PRINT *, "Hello World!" END PROGRAM HelloWorld
31. Lisp
Lisp (List Processing) is a family of programming languages known for their unique and distinctive parenthesized syntax and powerful support for symbolic processing.
Features of Lisp
- Symbolic Processing: Lisp’s homoiconic nature allows code and data to be represented as lists, making it well-suited for symbolic processing and metaprogramming.
- Recursive Design: Lisp encourages the use of recursion, making it easy to express complex algorithms and manipulate lists and trees.
- Macros: Lisp macros enable developers to create custom syntactic constructs, extending the language flexibly and expressively.
Lisp “Hello World” Program
(format t "Hello World!")
32. Prolog
Prolog is a logic programming language used for symbolic and declarative programming, particularly in the field of artificial intelligence and computational linguistics.
Features of Prolog
- Logical Programming: Prolog programs consist of rules, and facts expressed logically, making them well-suited for rule-based reasoning.
- Backtracking: Prolog uses a backtracking mechanism to explore multiple solutions, which is useful for solving search problems.
- Pattern Matching: Prolog’s pattern-matching capabilities allow it to find solutions by unifying terms with patterns in the knowledge base.
Prolog “Hello World” Program
hello_world :- write('Hello World!'), nl.
33. Ada
Ada is a high-level programming language designed for safety-critical and real-time systems, known for its strong type system and high reliability.
Features of Ada
- Strong Typing: Ada’s strong type system helps prevent errors and ensures type safety.
- Tasking: Ada supports concurrent programming through tasks, allowing developers to build real-time systems.
- Safety-Critical Applications: Ada is commonly used in safety-critical industries, such as aerospace, defense, and medical devices.
Ada “Hello World” Program
with Ada.Text_IO; procedure HelloWorld is begin Ada.Text_IO.Put_Line("Hello World!"); end HelloWorld;
34. Tcl
Tcl (Tool Command Language) is a dynamic and versatile scripting language known for easily integrating with other applications through its C API.
Features of Tcl
- Simple Syntax: Tcl has a straightforward syntax, using commands and arguments separated by spaces.
- Interpreted Language: Tcl is an interpreted language, allowing for rapid development and easy debugging.
- Extensibility: Tcl supports creating custom procedures and packages, making it highly extensible.
Tcl “Hello World” Program
puts "Hello World!"
35. PL/SQL
PL/SQL (Procedural Language/Structured Query Language) is an extension of SQL used in the Oracle Database for writing stored procedures, functions, triggers, and other database-related logic.
Features of PL/SQL
- Procedural Language Support: PL/SQL provides procedural constructs like loops, conditionals, and exception handling, allowing complex logic to be executed on the database server.
- SQL Integration: PL/SQL can embed SQL queries and DML statements directly within its procedural code.
- High Performance: PL/SQL is executed on the database server, reducing network traffic and enhancing performance.
PL/SQL “Hello World” Program
-- Anonymous PL/SQL block BEGIN DBMS_OUTPUT.PUT_LINE('Hello World!'); END;
36. D
D is a modern systems programming language known for its performance, safety features, and strong support for concurrent programming.
Features of D
- High Performance: D offers the performance of low-level languages like C and C++ with modern language features.
- Garbage Collection: D provides garbage collection to manage memory automatically and allows manual memory management when needed.
- Metaprogramming: D supports compile-time metaprogramming through templates, enabling code generation and optimization at compile time.
D “Hello World” Program
import std.stdio; void main() { writeln("Hello World!"); }
37. Scheme
Scheme is a minimalist dialect of the Lisp programming language, designed to be a simple and elegant language for functional programming and metaprogramming.
Features of Scheme
- Functional Programming: Scheme is a functional programming language treating computation as evaluating mathematical functions.
- First-Class Functions: Functions are first-class citizens in Scheme, meaning they can be assigned to variables, passed as arguments, and returned from other functions.
- Lexical Scoping: Scheme uses lexical scoping, which means the program’s structure determines variable bindings.
Scheme “Hello World” Program
(display "Hello World!") (newline)
38. SAS
SAS (Statistical Analysis System) is a programming language and software suite widely used for data management, statistical analysis, and reporting.
Features of SAS
- Data Manipulation: SAS provides powerful data manipulation and transformation capabilities, making it suitable for handling large datasets.
- Statistical Analysis: SAS offers a wide range of statistical procedures for analyzing data and generating insights.
- Report Generation: SAS allows users to create customized reports and output formats for presenting results.
SAS “Hello World” Program
data _null_; put "Hello World!"; run;
39. ABAP
ABAP (Advanced Business Application Programming) is a high-level programming language used for developing applications in the SAP environment, particularly for customizing SAP software.
Features of ABAP
- SAP Integration: ABAP is the primary language for customizing SAP applications and writing SAP system extensions.
- Database Access: ABAP provides features to interact with the underlying database, enabling data manipulation and retrieval.
- Rich Standard Library: ABAP has an extensive library containing pre-built functions and tools for SAP development.
ABAP “Hello World” Program
REPORT Z_HELLO_WORLD. WRITE 'Hello World!'.
40. Crystal
Crystal is a statically-typed, compiled programming language for simplicity, performance, and developer productivity.
Features of Crystal
- Statically-Typed: Crystal enforces strong static typing, catching type-related errors at compile-time.
- Ruby-like Syntax: Crystal’s syntax is heavily inspired by Ruby, making it easy for Ruby developers to transition to Crystal.
- Compiled to Native Code: Crystal code is compiled to efficient native machine code, resulting in high performance.
Crystal “Hello World” Program
puts "Hello World!"