Hello World/Code: Difference between revisions
Jump to navigation
Jump to search
imported>Johan Förberg (Examples moved from the main article) |
Pat Palmer (talk | contribs) m (Text replacement - "[[Ruby programming language|" to "[[Ruby (programming language)|") |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
int main() | int main() | ||
{ | { | ||
printf(" | printf("Hello, World!\n"); | ||
return 0; | return 0; | ||
} | } | ||
Line 24: | Line 24: | ||
} | } | ||
</pre> | </pre> | ||
=== Example in [[FORTRAN]] === | |||
WRITE (device, 100) | |||
100 FORMAT (12HHello, World) | |||
=== Example in Java === | === Example in Java === | ||
Line 62: | Line 65: | ||
</pre> | </pre> | ||
=== Example in [[Ruby programming language|Ruby]] === | === Example in [[Ruby (programming language)|Ruby]] === | ||
<pre> | <pre> | ||
# Hello World in Ruby | # Hello World in Ruby | ||
Line 95: | Line 98: | ||
</pre> | </pre> | ||
=== Example in [[ | === Example in [[JavaScript]] === | ||
<pre> | <pre> | ||
// Hello World in Javascript | // Hello World in Javascript |
Latest revision as of 15:37, 19 July 2024
These are Hello World examples in several common languages
Example in C
#include <stdio.h> int main() { printf("Hello, World!\n"); return 0; }
Example in C++
// Hello World in C++ (pre-ISO) #include <iostream.h> int main() { cout << "Hello World!" << endl; return 0; }
Example in FORTRAN
WRITE (device, 100) 100 FORMAT (12HHello, World)
Example in Java
// Hello World in [[Java]] class HelloWorld { static public void main( String args[] ) { System.out.println( "Hello World!" ); } }
Example in Perl
# Hello world in perl print "Hello World!\n";
Example in PHP
<?php // Hello World in PHP echo 'Hello World!'; ?>
Example in Python
# Hello World in Python print "Hello world"
Example in VBScript
'Hello World in VBScript WScript.Echo "Hello world"
Example in Ruby
# Hello World in Ruby puts 'Hello world'
Example in C#
// Hello World in C# class Hello { static void Main() { System.Console.WriteLine("Hello World"); } }
Example in Quick Basic
// Hello World in QBasic CLS phrase$ = "Hello World!" PRINT phrase$ END
Example in Actionscript
// Hello World in Actionscript trace("Hello World!")
Example in JavaScript
// Hello World in Javascript document.write("Hello World!")
Example in BASH shell scripting
#!/usr/bin/bash #This is the location of your BASH shell mytext="Hello World!" echo "$mytext"