3 ms·
Any that look familiar? - "Hello World" in 366 Languages
- jrockway 19y agoThe implementations are oddly inconsistent. Perl (not inside a function, newline printed) print "Hello, world.\n"; PHP (not inside a function, no newline printed: echo "Hello, world." Lisp (inside a function, no newline printed, no comma, exclamation mark): (defun helloworld () (print "Hello World!") ) ; <-- STYLE-WARNING: what the fuck is this? Emacs lisp (all lowercase, inside a function): (defun hello-world() "Display the string hello world." (interactive) (message "hello world")) Why a docstring and "interactive" declaration? (message "Hello, world.") would be just as valid. Anyway, I'd rewrite these to be more consistent: Perl: say 'Hello, world.'; Lisp: (format t "Hello, world.~%") Emacs: (message "Hello, world.") ; newline is unnecessary PHP: I don't know it.
- aston 19y agoPHP: <?echo "Hello, world."?>
- jws 19y ago366 languages and a do nothing program? Bah! http://99-bottles-of-beer.net/ http://99-bottles-of-beer.net/ for 1200 languages and a real program. (For a certain definition of real.) The bottles of beer is also inconsistent. Not everyone handles the zero, singular, plural issues correctly. This may not be a defect. Perhaps it tells you something about the sort of people that use a language. (Although I am slightly shamed to notice I missed a capitalization issue in the Dylan sample. I should have made a capitalize() function.)