世界末日道别仪式,大家一起用各种语言写 "bye world"

之前SegmentFault上面有一个问题是《如何用各种编程语言书写hello world》

byeworld-1-.jpg

这不,SegmentFault Team最近搞了一个世界末日大挑战的【黑客马拉松·杭州】活动,刚刚在黑客马拉松群里,SF的资深用户、也是我们这次黑客马拉松的参赛者:代码湿人芋头提出要搞一个《2012.12.21世界末日道别仪式,大家一起用各种语言写 "bye world"》

大家一起来试试,不要太拘禁,要发挥想象力哦~

世界末日前夕感觉无聊?挑战一下曾经在11.11SF出品的Hackgame《光棍节程序员闯关秀

阅读 28.3k
55 个回答

来点古董的

Batch

@echo off
set var=bye world 
@echo %var%
set var=
@echo on

MySQL

Select "Bye world"

汇编

    dseg segment  
     message DB 'bye world', 0DH, 0AH, 24H  
    dseg ends  
      
    cseg segment  
       assume cs:cseg, ds: dseg  
       begin:  
         mov ax, dseg  
         mov ds,ax  
         mov dx, offset message  
         mov ah, 9  
         int 21h  
           
         mov ah,4ch  
         int 21h  
    cseg ends  
        end begin  

moescript:

trace "VALE MVNDI."

Brainf**k

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

Brainf**k 的 ASCII Art 版本,这可是我手工排版的,运行的结果和上面的一样,都是 Bye World

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

Befunge

VV,--1*<
84V+*2<7
:8,V8<53
**3-@,$,
2,+>V-$+
+9>,6^,-
,>:*6+^2
>99*76*^
V$$$<@,<
>,48*1+^

另一个更容易读懂的 Befunge 代码

"!dlroW eyB">:v
            ^,_@

这个可能更容易 Bye World 一点

>                v
>:v:<"Bye World!"<
^,_@

BIT

LINENUMBERZEROCODEPRINTZEROGOTOONELINENUMBERONECODEPRINTONEGOTOON
EZEROLINENUMBERONEZEROCODEPRINTZEROGOTOONEONELINENUMBERONEONECODE
PRINTZEROGOTOONEZEROZEROLINENUMBERONEZEROZEROCODEPRINTZEROGOTOONE
ZEROONELINENUMBERONEZEROONECODEPRINTZEROGOTOONEONEZEROLINENUMBERO
NEONEZEROCODEPRINTONEGOTOONEONEONELINENUMBERONEONEONECODEPRINTZER
OGOTOONEZEROZEROZEROLINENUMBERONEZEROZEROZEROCODEPRINTZEROGOTOONE
ZEROZEROONELINENUMBERONEZEROZEROONECODEPRINTONEGOTOONEZEROONEZERO
LINENUMBERONEZEROONEZEROCODEPRINTONEGOTOONEZEROONEONELINENUMBERON
EZEROONEONECODEPRINTONEGOTOONEONEZEROZEROLINENUMBERONEONEZEROZERO
CODEPRINTONEGOTOONEONEZEROONELINENUMBERONEONEZEROONECODEPRINTZERO
GOTOONEONEONEZEROLINENUMBERONEONEONEZEROCODEPRINTZEROGOTOONEONEON
EONELINENUMBERONEONEONEONECODEPRINTONEGOTOONEZEROZEROZEROZEROLINE
NUMBERONEZEROZEROZEROZEROCODEPRINTZEROGOTOONEZEROZEROZEROONELINEN
UMBERONEZEROZEROZEROONECODEPRINTONEGOTOONEZEROZEROONEZEROLINENUMB
ERONEZEROZEROONEZEROCODEPRINTONEGOTOONEZEROZEROONEONELINENUMBERON
EZEROZEROONEONECODEPRINTZEROGOTOONEZEROONEZEROZEROLINENUMBERONEZE
ROONEZEROZEROCODEPRINTZEROGOTOONEZEROONEZEROONELINENUMBERONEZEROO
NEZEROONECODEPRINTONEGOTOONEZEROONEONEZEROLINENUMBERONEZEROONEONE
ZEROCODEPRINTZEROGOTOONEZEROONEONEONELINENUMBERONEZEROONEONEONECO
DEPRINTONEGOTOONEONEZEROZEROZEROLINENUMBERONEONEZEROZEROZEROCODEP
RINTZEROGOTOONEONEZEROZEROONELINENUMBERONEONEZEROZEROONECODEPRINT
ZEROGOTOONEONEZEROONEZEROLINENUMBERONEONEZEROONEZEROCODEPRINTONEG
OTOONEONEZEROONEONELINENUMBERONEONEZEROONEONECODEPRINTZEROGOTOONE
ONEONEZEROZEROLINENUMBERONEONEONEZEROZEROCODEPRINTZEROGOTOONEONEO
NEZEROONELINENUMBERONEONEONEZEROONECODEPRINTZEROGOTOONEONEONEONEZ
EROLINENUMBERONEONEONEONEZEROCODEPRINTZEROGOTOONEONEONEONEONELINE
NUMBERONEONEONEONEONECODEPRINTZEROGOTOONEZEROZEROZEROZEROZEROLINE
NUMBERONEZEROZEROZEROZEROZEROCODEPRINTZEROGOTOONEZEROZEROZEROZERO
ONELINENUMBERONEZEROZEROZEROZEROONECODEPRINTONEGOTOONEZEROZEROZER
OONEZEROLINENUMBERONEZEROZEROZEROONEZEROCODEPRINTZEROGOTOONEZEROZ
EROZEROONEONELINENUMBERONEZEROZEROZEROONEONECODEPRINTONEGOTOONEZE
ROZEROONEZEROZEROLINENUMBERONEZEROZEROONEZEROZEROCODEPRINTZEROGOT
OONEZEROZEROONEZEROONELINENUMBERONEZEROZEROONEZEROONECODEPRINTONE
GOTOONEZEROZEROONEONEZEROLINENUMBERONEZEROZEROONEONEZEROCODEPRINT
ONEGOTOONEZEROZEROONEONEONELINENUMBERONEZEROZEROONEONEONECODEPRIN
TONEGOTOONEZEROONEZEROZEROZEROLINENUMBERONEZEROONEZEROZEROZEROCOD
EPRINTZEROGOTOONEZEROONEZEROZEROONELINENUMBERONEZEROONEZEROZEROON
ECODEPRINTONEGOTOONEZEROONEZEROONEZEROLINENUMBERONEZEROONEZEROONE
ZEROCODEPRINTONEGOTOONEZEROONEZEROONEONELINENUMBERONEZEROONEZEROO
NEONECODEPRINTZEROGOTOONEZEROONEONEZEROZEROLINENUMBERONEZEROONEON
EZEROZEROCODEPRINTONEGOTOONEZEROONEONEZEROONELINENUMBERONEZEROONE
ONEZEROONECODEPRINTONEGOTOONEZEROONEONEONEZEROLINENUMBERONEZEROON
EONEONEZEROCODEPRINTONEGOTOONEZEROONEONEONEONELINENUMBERONEZEROON
EONEONEONECODEPRINTONEGOTOONEONEZEROZEROZEROZEROLINENUMBERONEONEZ
EROZEROZEROZEROCODEPRINTZEROGOTOONEONEZEROZEROZEROONELINENUMBERON
EONEZEROZEROZEROONECODEPRINTONEGOTOONEONEZEROZEROONEZEROLINENUMBE
RONEONEZEROZEROONEZEROCODEPRINTONEGOTOONEONEZEROZEROONEONELINENUM
BERONEONEZEROZEROONEONECODEPRINTONEGOTOONEONEZEROONEZEROZEROLINEN
UMBERONEONEZEROONEZEROZEROCODEPRINTZEROGOTOONEONEZEROONEZEROONELI
NENUMBERONEONEZEROONEZEROONECODEPRINTZEROGOTOONEONEZEROONEONEZERO
LINENUMBERONEONEZEROONEONEZEROCODEPRINTONEGOTOONEONEZEROONEONEONE
LINENUMBERONEONEZEROONEONEONECODEPRINTZEROGOTOONEONEONEZEROZEROZE
ROLINENUMBERONEONEONEZEROZEROZEROCODEPRINTZEROGOTOONEONEONEZEROZE
ROONELINENUMBERONEONEONEZEROZEROONECODEPRINTONEGOTOONEONEONEZEROO
NEZEROLINENUMBERONEONEONEZEROONEZEROCODEPRINTONEGOTOONEONEONEZERO
ONEONELINENUMBERONEONEONEZEROONEONECODEPRINTZEROGOTOONEONEONEONEZ
EROZEROLINENUMBERONEONEONEONEZEROZEROCODEPRINTONEGOTOONEONEONEONE
ZEROONELINENUMBERONEONEONEONEZEROONECODEPRINTONEGOTOONEONEONEONEO
NEZEROLINENUMBERONEONEONEONEONEZEROCODEPRINTZEROGOTOONEONEONEONEO
NEONELINENUMBERONEONEONEONEONEONECODEPRINTZEROGOTOONEZEROZEROZERO
ZEROZEROZEROLINENUMBERONEZEROZEROZEROZEROZEROZEROCODEPRINTZEROGOT
OONEZEROZEROZEROZEROZEROONELINENUMBERONEZEROZEROZEROZEROZEROONECO
DEPRINTONEGOTOONEZEROZEROZEROZEROONEZEROLINENUMBERONEZEROZEROZERO
ZEROONEZEROCODEPRINTONEGOTOONEZEROZEROZEROZEROONEONELINENUMBERONE
ZEROZEROZEROZEROONEONECODEPRINTZEROGOTOONEZEROZEROZEROONEZEROZERO
LINENUMBERONEZEROZEROZEROONEZEROZEROCODEPRINTZEROGOTOONEZEROZEROZ
EROONEZEROONELINENUMBERONEZEROZEROZEROONEZEROONECODEPRINTONEGOTOO
NEZEROZEROZEROONEONEZEROLINENUMBERONEZEROZEROZEROONEONEZEROCODEPR
INTZEROGOTOONEZEROZEROZEROONEONEONELINENUMBERONEZEROZEROZEROONEON
EONECODEPRINTZEROGOTOONEZEROZEROONEZEROZEROZEROLINENUMBERONEZEROZ
EROONEZEROZEROZEROCODEPRINTZEROGOTOONEZEROZEROONEZEROZEROONELINEN
UMBERONEZEROZEROONEZEROZEROONECODEPRINTZEROGOTOONEZEROZEROONEZERO
ONEZEROLINENUMBERONEZEROZEROONEZEROONEZEROCODEPRINTONEGOTOONEZERO
ZEROONEZEROONEONELINENUMBERONEZEROZEROONEZEROONEONECODEPRINTZEROG
OTOONEZEROZEROONEONEZEROZEROLINENUMBERONEZEROZEROONEONEZEROZEROCO
DEPRINTZEROGOTOONEZEROZEROONEONEZEROONELINENUMBERONEZEROZEROONEON
EZEROONECODEPRINTZEROGOTOONEZEROZEROONEONEONEZEROLINENUMBERONEZER
OZEROONEONEONEZEROCODEPRINTZEROGOTOONEZEROZEROONEONEONEONELINENUM
BERONEZEROZEROONEONEONEONECODEPRINTONEGOTOONEZEROONEZEROZEROZEROZ
EROLINENUMBERONEZEROONEZEROZEROZEROZEROCODEPRINTZEROGOTOONEZEROON
EZEROZEROZEROONELINENUMBERONEZEROONEZEROZEROZEROONECODEPRINTZEROG
OTOONEZEROONEZEROZEROONEZEROLINENUMBERONEZEROONEZEROZEROONEZEROCO
DEPRINTZEROGOTOONEZEROONEZEROZEROONEONELINENUMBERONEZEROONEZEROZE
ROONEONECODEPRINTZEROGOTOONEZEROONEZEROONEZEROZEROLINENUMBERONEZE
ROONEZEROONEZEROZEROCODEPRINTONEGOTOONEZEROONEZEROONEZEROONELINEN
UMBERONEZEROONEZEROONEZEROONECODEPRINTZEROGOTOONEZEROONEZEROONEON
EZEROLINENUMBERONEZEROONEZEROONEONEZEROCODEPRINTONEGOTOONEZEROONE
ZEROONEONEONEONELINENUMBERONEZEROONEZEROONEONEONEONECODEPRINTZERO
新手上路,请多包涵

C++

#include <iostream>
#include <string>
using namespace std;

class Object
{
private:
	string objectName;

public:
	Object(const char* name)
	{
		objectName = name;
	}

	const char* getName() const
	{
		return objectName.c_str();
	}
};

class World : public Object
{
public:
	World() : Object("world")
	{
	} 
};

class Action
{
public:
	virtual int to(Object* ob) = 0;
};

class Bye : public Action
{
public:
	int to(Object* ob)
	{
		cout<<"bye "<<ob->getName()<<endl;
		return 0;
	} 	
};

int main(int argc, const char* argv[])
{
	Bye bye;
	World world;
	return bye.to(&world);
}

占楼。

javascript:

console.log("bye world");
alert("bye javascript");

<?php
echo base64_decode('YnllIHdvcmxk');
?>

Python:

print 'bye world'
新手上路,请多包涵

ruby

puts 'bye world'
#include <stdio.h>

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

爪哇

package com.ByeWorld;

public class ByeWorld {
	public static void main(String[] args) {
		System.out.print("Bye,World!");
	}
}

R

> paste("bye", "world")
新手上路,请多包涵

php

  echo "bye world";

C#

Console.WriteLine("bye world");

Bash

#!/bin/bash
echo "Bye world!"

Actionscript

    trace("Bye world!");

<h1>Bye <del>World</del></h1>

新手上路,请多包涵

Go.

package main
import "fmt"
func main() {
  fmt.Printf("Bye, Sexy World\n")
}
(println "Bye, world,")
新手上路,请多包涵

<%="Bye,World!"%>

我就知道肯定没人来写D语言的……:
import std.stdio;
void main() {
writeln("Bye, World!");
}

perl

print "bye world! \n";
新手上路,请多包涵

pascal

begin
    writeln('bye world!');
end.

凑热闹,来个rakudo的:
say "Bye World";

搞一个CSS的,凑热闹
*:after{content:"bye world"}

cout << "bye world" << endl;
新手上路,请多包涵

再来个JS的:
console.log("\u0042\u0079\u0020\u0057\u006f\u0072\u006c\u0064");

Scheme

(begin
(display "bye world")
)

十六进制:'0x62', '0x79', '0x65', '0x20', '0x77', '0x6f', '0x72', '0x6c', '0x64'
二进制:'0b1100010', '0b1111001', '0b1100101', '0b100000', '0b1110111', '0b1101111', '0b1110010', '0b1101100', '0b1100100'

新手上路,请多包涵

printf("bye world\n");`

Response.Write("Bye World!");

新手上路,请多包涵

Lolcode:
HAI
CAN HAS STDIO?
VISIBLE “BYE WORLD!”
KTHXBYE

新手上路,请多包涵

$echo "bye world"

JAVA

System.out.println("Bey World!");

`$(document).ready(function() {
document.write('Bye world');
}`

新手上路,请多包涵

C语言版的

#include <stdio.h>
int n[] = {0x62, 0x79, 0x65, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x00}, *m = n;
int main(n)
{
	if(putchar(*m) != '\0')
	{
		main(m ++);
	}
	return 0;
}
新手上路,请多包涵

obj-c

NSLog(@"Bye world!");

1 #/usr/bin/perl
2 #
3 use strict;
4 use warnings;
5
6
7 print "Bey Wrold\n";

新手上路,请多包涵

为什么没VB的呢

msgbox 'bye world'
新手上路,请多包涵

lua

function printBye(printString)
    print(printString)
end
 
printBye("Bye World")

Clojure
(def bye-world (fn [] "bye world"))

Io

"bye world" print

ruby

puts "bye world"

javascript

console.log("bye world");

html

<html>
<head></head>
<body>
<p>bye world</p>
</body>
</html>
新手上路,请多包涵

scala

object Bye extends App {
	println("bye, world!")
}

我会的你们都已经贴出来了,我只能来个母语了:

大声喊:拜拜,我的世界!!!

Jquery

$("#me").html("bye, world!");

新手上路,请多包涵

Java

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

PHP

   echo "Bye,World";

JS

   console.log("Bye,World");

JQ

  $(function(){
   $('#SayBye').html("Bye,World");
});

SQL

  Select ISay from MyWords  where say_date='2012-12-21' and word ='Bye,World';

Haskell

main = putStrLn "Bye world"

Plus >> Прощай, мир
=3=

我来个SQL的

> DROP DATABASE earth;

objective-c
NSLog(@"bye,world??");

vimscript
:echom "bye world"

新手上路,请多包涵

自然语言

bye world

新手上路,请多包涵

matlab :

disp('Bye world!')

AWK:

begin{ print "Bye world!" }

新手上路,请多包涵

易语言:
控制台.输出行(“Bye world”);

新手上路,请多包涵
#import <Foundation/Foundation.h>

 @interface EndOfWorld : NSObject {
 }
 - end;
 @end

 @implementation EndOfWorld
 - end {
  NSLog(@"Bye World!");
 }
 @end

 int main(int argc, char *argv[]) {
  EndOfWorld *gr = [EndOfWorld new];
  [gr end];
  [gr release];
  return 0;
 }
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏