1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

名だたる言語たちによる「Hello, World!」の出力です。
それぞれのキャラクター(設計思想)がコードによく表れています。

あなたはどの言語が好きですか?

1. 低級・システムプログラミング言語

ハードウェアに近い層の言語です。

Assembler (x86-64 macOS/Linux)

section .data
    msg db 'Hello, world!', 0xa

section .text
    global _start

_start:
    mov rax, 1          ; writeシステムコール
    mov rdi, 1          ; stdout
    mov rsi, msg        ; 文字列のアドレス
    mov rdx, 14         ; 文字列の長さ
    syscall
    mov rax, 60         ; exitシステムコール
    xor rdi, rdi
    syscall

C

#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}

C++

#include <iostream>

int main() {
    std::cout << "Hello, world!" << std::endl;
    return 0;
}

Rust

fn main() {
    println!("Hello, world!");
}

2. 伝統的なプログラミング言語

歴史を支えてきた重鎮たちです。

Fortran

program hello
    print *, "Hello, world!"
end program hello

Lisp (Common Lisp)

(format t "Hello, world!~%")

Pascal

program Hello;
begin
  writeln('Hello, world!');
end.

COBOL

       IDENTIFICATION DIVISION.
       PROGRAM-ID. HELLO-WORLD.
       PROCEDURE DIVISION.
           DISPLAY 'Hello, world!'.
           STOP RUN.

3. エンタープライズ・オブジェクト指向

堅牢なアプリケーション開発の主役です。

Java

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
    }
}

C#

using System;

class Program {
    static void Main() {
        Console.WriteLine("Hello, world!");
    }
}

4. スクリプト・LL(Lightweight Language)

直感的で記述量が少ないのが特徴です。

Python

print("Hello, world!")

Ruby

puts "Hello, world!"

Perl

print "Hello, world!\n";

JavaScript (Node.js)

console.log("Hello, world!");

PHP

<?php
echo "Hello, world!\n";

5. シェル・コマンドライン

OSを操作するためのスクリプトです。

BASIC (Classic)

10 PRINT "Hello, world!"
20 END

Shell Script (Bash)

#!/bin/bash
echo "Hello, world!"

PowerShell

Write-Host "Hello, world!"

6. 近代・モダンなシステム言語

高速さと安全性を両立させた言語たちです。

Go

package main
import "fmt"

func main() {
    fmt.Println("Hello, world!")
}

Swift

import Foundation

print("Hello, world!")

7. データサイエンス・統計

研究や解析の現場で愛されている言語です。

R

cat("Hello, world!\n")

Julia

println("Hello, world!")

8. 歴史的・特殊な用途

Apple製品の開発を長く支えた言語と、Webの骨組みです。

Objective-C

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSLog(@"Hello, world!");
    }
    return 0;
}

HTML

<!DOCTYPE html>
<html>
<body>
    <h1>Hello, world!</h1>
</body>
</html>

9. モダンJVM言語

Kotlin

fun main() {
    println("Hello, world!")
}

10. クロスプラットフォーム開発

Dart (コンソール出力)

もっともシンプルな、標準出力の形です。

void main() {
  print('Hello, world!');
}

Flutter (Widgetとして画面中央に表示)

スマホアプリとして、画面の真ん中に文字を出すコードです。

import 'package:flutter/material.dart';

void main() {
  runApp(
    const MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('Hello, world!'),
        ),
      ),
    ),
  );
}

11. モダン・Web・関数型

より簡潔に、あるいは厳密に書きたい時に使われる言語です。

TypeScript

JavaScriptに型を加えた、現在のWeb開発のデファクトスタンダードです。

const message: string = "Hello, world!";
console.log(message);

Haskell

純粋関数型言語の代表格です。

main = putStrLn "Hello, world!"

Elixir

並行処理に強い、Erlangの仮想マシン上で動くモダンな言語です。

IO.puts "Hello, world!"

Scala

Javaとの互換性を持ちつつ、オブジェクト指向と関数型を融合させた言語です。

object Main extends App {
  println("Hello, world!")
}

12. 特殊・学術的・ハードウェア

特定の専門分野で力を発揮する言語です。

Prolog (論理プログラミング)

「事実」と「規則」を記述する言語です。

main :- write('Hello, world!'), nl.

SQL (データベース)

厳密には「問い合わせ言語」ですが、出力を出すことは可能です。

SELECT 'Hello, world!';

Verilog (ハードウェア記述言語)

電子回路を設計するための言語です。

module hello;
  initial begin
    $display("Hello, world!");
    $finish;
  end
endmodule

13. 難解プログラミング言語 (Esoteric Languages)

実用性ではなく、概念の面白さや難解さを追求した言語です。

Brainfuck
たった8つの記号だけで記述します。

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

Whitespace
スペース、タブ、改行だけで構成されます(以下はイメージです。実際は何も見えません)。

[space][space][space][tab]... (可視化不能)

Chef

プログラムが「料理のレシピ」のように見えます。

Hello World Cake with Chocolate sauce.

Ingredients.
101 g eggs
111 g sugar
...
Method.
Put sugar into mixing bowl.
...

14. 日本生まれの言語

なでしこ (日本語プログラミング言語)

「Hello, world!」と表示。
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?