First article! Definitely must be a “Hello World” examples article. A “Hello World” program is a computer program which prints out “Hello, world!” on a display device. It is used in many introductory tutorials for teaching a programming language.
It is often considered to be tradition among programmers for people attempting to learn a new programming language to write a “Hello World!” program as one of the first steps of learning that particular language. Such a program is typically one of the simplest programs possible in most computer languages.
C example:
#include int main(void) { printf("Hello, World!\n"); return 0; }
C++ example:
#include using namespace std; int main() { cout<< "Hello, world!\n"; return 0; }
C# example:
class HelloWorldApp { static void Main() { System.Console.WriteLine("Hello, world!"); } }
JavaScript example:
document.write('Hello, world!'); alert('Hello, world!');
Perl example:
print "Hello, world!\n";
PHP example:
<? print "Hello, world!";?>
Pascal example:
program hello; begin writeln('Hello, world!'); readln; end.
SQL example:
CREATE TABLE message (text char(15)); INSERT INTO message (text) VALUES ('Hello, world!'); SELECT text FROM message; DROP TABLE message;
Bash or sh example:
echo 'Hello, world!' printf 'Hello, world!\n' printf '%s' #Hello, world!\n'
Hello world!