hello world程序集锦(4)

JSP

<%
 out.print("Hello, world!");
%>
或者简单地写成:

<%="Hello, world!"%>

Lisp

;直接输出
"hello, world"

;或者
(format t "hello, world~%")

Lua

print "Hello, world!"

Malbolge

 ('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
 `CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>

Metapost

beginfig(1);
draw (0,0)--(0,10);
draw (0,5)--(5,5);
draw (5,0)--(5,10);
draw (12,0)--(7,0)--(7,10)--(12,10);
draw (12,5)--(7,5);
draw (14,10)--(14,0)--(19,0);
draw (21,10)--(21,0)--(26,0);
draw (28,5)...(30.5,0)...(33,5)...(30.5,10)...cycle;
draw (38,10)--(39.25,0)--(40.5,10)--(41.75,0)--(43,10);
draw (45,5)...(47.5,0)...(50,5)...(47.5,10)...cycle;
draw (52,0)--(52,10);
draw (52,10)..(57,4)..(52,6.5);
draw (52,5)--(57,0);
draw (61,10)--(61,0)--(66,0);
draw (68,10)--(68,0)..(73,5)..cycle;
endfig;
end

MIXAL

TERM EQU 19 the MIX console device number
  ORIG 1000  start address
START OUT MSG(TERM) output data at address MSG
  HLT    halt execution
MSG ALF "MIXAL"
  ALF " HELL"
  ALF "O WOR"
  ALF "LD "
  END START  end of the program

Nuva

<..直接输出..>
Hello, world!

<..或者..>

<.
 // 不带换行
 ? "Hello, world!"

 // 或者

 // 带换行
 ?? 'Hello, world!'
.>

OCaml

let main () =
 print_endline "Hello world!";;

Pascal

program Hello;{此行可以省略}
begin
 writeln('Hello, world!');
end.

Perl

#!/usr/bin/env perl
print "Hello, world!\n";

Perl 5.10(含)以后版本:

#!/usr/bin/env perl
use 5.010;
say "Hello, world!";

PHP

<?php
 echo 'Hello, world!';//通常使用這個,比 print 少一個字元
 print 'Hello, world!';
?>
或者

<?= "Hello World!"?>

Pike

#!/usr/local/bin/pike
int main()
{
 write("Hello, world!\n");
 return 0;
}

PL/I

Test: procedure options(main);
 declare My_String char(20) varying initialize('Hello, world!');
 put skip list(My_String);
end Test;

Prolog

goal
 write("hello,world!").

Python

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/1615.html