• 15.3k

如何用各种编程语言书写hello world

我先来个php的

<?php
echo 'hello world';
阅读 26k
评论
    34 个回答
    • 1.7k

    来个css的

    *:before,
    *:after { content:'hello word' }

      Fortran:
      -------------------------------------------------

      program main
          write (unit = *, fmt = * ) "hello, world!"
          stop
      end program main

      =================================================

      传中的BrainFuck:
      -------------------------------------------------

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

        Ruby:

        puts "Hello World"
          • 6.1k

          来个 python 的

          #!/usr/bin/env python
          print("hello world")
            • 134

            我来个lua的

            -- hello world from lua
            
            io.write("Hello world")
              • 62

              我来个java的

              public class HelloWord {
              	public static void main(String[] args) {	
              		System.out.println("hello world");
              	}
              }

                我来个haskell版本的

                module Main where
                 
                main :: IO ()
                main = putStrLn "Hello, World!"
                  • 348

                  shell 也算语言吧?

                  printf "Hello world"

                    来个AS的,现问的人 -。-

                    trace("Hello world")
                      • 13.3k

                      各位大神都不写C的啊。。那我献丑了-。-

                      #include <stdio.h>
                      
                      int main() {
                          printf("Hello, world!");
                          return 0;
                      }
                        • 171

                        LISP:

                        (DEFUN HELLO()
                          "HELLO WORLD"
                        )

                        Small Talk:

                        Transcript show: 'Hello, world!'.
                          • 328

                          Javascript:

                          document.write("Hello, world!");

                            Erlang:

                            io:format("Hello, world~n").
                              • 5.1k

                              Perl:

                              print "Hello, World.\n";

                                我接触的第一门语言 Pascal:

                                program Bonjour;
                                begin
                                    writeln('Bonjour le monde');
                                end.

                                  ASP:

                                  <% Response.Write "Hello World" %>

                                    Bash:

                                    #!/bin/bash
                                    echo 'Hello World!'

                                    Prolog:

                                    write('Hello World!'), nl.

                                    BASIC:

                                    PRINT "Hello World"
                                      • 1.6k

                                      SQL算吗

                                      SELECT "Hello World!"

                                          来个古董级的, Batch

                                          @echo hello world!
                                          @echo off
                                          pause
                                            • 2
                                            • 新人请关照

                                            C-INTERCAL

                                            PLEASE DO ,1 <- #13
                                            DO ,1 SUB #1 <- #238
                                            DO ,1 SUB #2 <- #112
                                            DO ,1 SUB #3 <- #112
                                            DO ,1 SUB #4 <- #0
                                            DO ,1 SUB #5 <- #64
                                            DO ,1 SUB #6 <- #238
                                            DO ,1 SUB #7 <- #26
                                            DO ,1 SUB #8 <- #248
                                            PLEASE DO ,1 SUB #9 <- #168
                                            DO ,1 SUB #10 <- #24
                                            DO ,1 SUB #11 <- #16
                                            DO ,1 SUB #12 <- #158
                                            DO ,1 SUB #13 <- #52
                                            
                                            PLEASE READ OUT ,1
                                            PLEASE GIVE UP
                                              • 2
                                              • 新人请关照

                                              GO Language

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

                                                GAS

                                                .section .data
                                                str:
                                                .ascii "Hello World!"
                                                
                                                .section .text
                                                .global _start
                                                _start:
                                                    movl  $4, %eax
                                                    movl  $1, %ebx
                                                    movl  $str, %ecx
                                                    movl  $12, %edx
                                                    int   $0x80
                                                    movl  $1, %eax
                                                    movl  $0, %ebx
                                                    int   $0x80
                                                  • 2
                                                  • 新人请关照

                                                  Apple Script

                                                  display dialog "hello world"

                                                    继续古董级, shell

                                                    echo Hello world!

                                                    ...C#要么

                                                    using System;
                                                    public class HelloWorld
                                                    {
                                                       public static void Main()
                                                       {
                                                          Console.WriteLine("Hello World!");
                                                       }
                                                    }

                                                      SCALA

                                                      object HelloWorld extends Application {
                                                        println("Hello World")
                                                      }
                                                        • 4
                                                        • 新人请关照

                                                        嘿嘿,我加一个dos bat的吧

                                                        echo hello world!

                                                          我来个AutoIt 3的代码好了

                                                          MsgBox(0, "Dialog", "Hello World!")
                                                            • 1.8k

                                                            写了n年的objc
                                                            Objective c
                                                            NSLog(@"Hello,World");

                                                              • 1
                                                              • 新人请关照

                                                              13种最为荒谬的编程语言
                                                              http://sd.csdn.net/a/20110411/295610....
                                                              Lolcode
                                                              “Hello World” example:
                                                              HAI
                                                              CAN HAS STDIO?
                                                              VISIBLE “HAI WORLD!”
                                                              KTHXBYE
                                                              Befunge
                                                              “Hello World” example:
                                                              "dlroW olleH">:v
                                                              ^,_@
                                                              Brainfuck
                                                              “Hello World” example:
                                                              ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++
                                                              ..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
                                                              还有更多恶搞语言的写法,简直变态
                                                              http://sd.csdn.net/a/20110411/295610....

                                                                • 4
                                                                • 新人请关照

                                                                Matlab:

                                                                disp('Hello, World!')
                                                                  • 144

                                                                  hello word

                                                                  php的。

                                                                    • 2
                                                                    • 新人请关照

                                                                    Scheme

                                                                    (display "Hello World")
                                                                      • 870

                                                                      System.out.println("Hello World");

                                                                        撰写回答

                                                                        登录后参与交流、获取后续更新提醒

                                                                        相似问题
                                                                        101 新手上路
                                                                        合作问答

                                                                        欢迎来到 SegmentFault 101 新手上路问答。如果你是开发新手,有各种各样的疑惑,但又害怕提出来被嘲笑...

                                                                        推荐文章