2023年TIOBE指数TOP50的编程语言写“Hello World!”

2024-01-07 17:28:07

这篇文章列出了TIOBE指数TOP50的编程语言(TIOBE Index - TIOBE)如何写“Hello World!”。“Hello World!”代码应该是每个程序员学习一门编程语言最先实现的程序,给我们带来了很多美好的回忆,下面我们就一次过足瘾,看看如何使用2023年TIOBE指数TOP50的编程语言写“Hello World!”。

Python

print("Hello World")

C

#include <stdio.h>
int main() {
   printf("Hello World");
   return 0;
}

C++

#include <iostream>
int main() {
   std::cout << "Hello World";
   return 0;
}

Java

public class HelloWorld {
   public static void main(String[] args) {
      System.out.println("Hello World");
   }
}

C#

using System;
class Program {
   static void Main(string[] args) {
      Console.WriteLine("Hello World");
   }
}

JavaScript

console.log("Hello World");

PHP

<?php echo "Hello World"; ?>

Visual Basic

Module Module1
    Sub Main()
       Console.WriteLine("Hello World")
    End Sub
End Module

SQL

SELECT 'Hello World';

Assembly

section .text
global _start

_start:
    mov edx, len    ;message length
    mov ecx, msg    ;message to write
    mov ebx, 1      ;file descriptor (stdout)
    mov eax, 4      ;system call for sys_write
    int 0x80        ;call kernel

    mov eax, 1      ;system call for sys_exit
    int 0x80        ;call kernel

section .data
msg db 'Hello, world!',0xa  ;our dear string
len equ $ - msg             ;length of our dear string

Scratch

"say" block with "Hello World"

Fortran

program hello
print *, 'Hello World'
end program hello

Go

package main
import "fmt"
func main() {
    fmt.Println("Hello World")
}

MATLAB

disp('Hello World')

Kotlin

fun main() {
    println("Hello World")
}

Delphi/Object Pascal

program HelloWorld;
begin
  WriteLn('Hello World');
end.

Swift

print("Hello World")

Rust

fn main() {
    println!("Hello World");
}

Ruby

puts "Hello World"

R

print("Hello World")

Prolog

:- initialization(main).
main :- write('Hello World'), nl.

D

import std.stdio;
void main() {
    writeln("Hello World");
}

COBOL

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
    DISPLAY 'Hello World'.
    STOP RUN.

SAS

data _null_;
put 'Hello World';
run;

Classic Visual Basic (VB6)

Sub Main()
   MsgBox "Hello World"
End Sub

F#

printfn "Hello World"

(Visual) FoxPro

? "Hello World"

Ada?

with Ada.Text_IO;
procedure Hello is
begin
  Ada.Text_IO.Put_Line("Hello World");
end Hello;

Perl

print "Hello World\n";

VBScript

WScript.Echo "Hello World"

Dart

void main() {
  print('Hello World');
}

Julia

println("Hello World")

Transact-SQL

PRINT 'Hello World';

Objective-C

#import <Foundation/Foundation.h>
int main() {
    NSLog(@"Hello World");
    return 0;
}

Lua

print("Hello World")

Scala

object HelloWorld extends App {
  println("Hello World")
}

X++ (Used in Microsoft Dynamics AX)

static void Job1(Args _args)
{
    info("Hello World");
}

TypeScript

console.log("Hello World");

Lisp

(print "Hello World")

Haskell

main = putStrLn "Hello World"

ML (Standard ML)

print "Hello World\n";

Forth

." Hello World"

Scheme

(display "Hello World")
(newline)

ABAP

WRITE 'Hello World'.

Awk

BEGIN { print "Hello World" }

Logo

print [Hello World]

PL/SQL

BEGIN
  DBMS_OUTPUT.PUT_LINE('Hello World');
END;

CFML (ColdFusion)

<cfoutput>Hello World</cfoutput>

PowerShell

Write-Host "Hello World"

ActionScript

trace("Hello World");

文章来源:https://blog.csdn.net/jkol12/article/details/135365890
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。