us1415
June 7, 2014, 11:30pm
1
Here is one for Java:
/*************************************************************************
* Compilation: javac HelloWorld.java
* Execution: java HelloWorld
*
* Prints "Hello, World". By tradition, this is everyone's first program.
*
* % java HelloWorld
* Hello, World
*
* These 17 lines of text are comments. They are not part of the program;
* they serve to remind us about its properties. The first two lines tell
* us what to type to compile and test the program. The next line describes
* the purpose of the program. The next few lines give a sample execution
* of the program and the resulting output. We will always include such
* lines in our programs and encourage you to do the same.
*
*************************************************************************/
public class HelloWorld {
public static void main(String] args) {
System.out.println("Hello, World");
}
}
Please feel free to post other examples.
Re: Hello world! Examples of different languages
/* Hello World program in C*/
#include<stdio.h>
main()
{
printf("Hello World");
}
Re: Hello world! Examples of different languages
#python 3 hello world example
print("Hello, World!")
LP
June 8, 2014, 12:04pm
4
Re: Hello world! Examples of different languages
I wanted to do C
LP
June 8, 2014, 12:07pm
5
Re: Hello world! Examples of different languages
I'll try C++ . Been 12 yrs since I did that, but well, I'll give it a try.
include
Void main()
{
cout <<"Hello World";
}
PS: correct me if I'm wrong.
LP
June 8, 2014, 3:04pm
6
Re: Hello world! Examples of different languages
HTML
Hello World!
Re: Hello world! Examples of different languages
Was "PS correct me if I am wrong" part of the code?
Re: Hello world! Examples of different languages
Assembly language — MOS Technology 6502, Apple II (II+, IIe, IIC)
; Uses S-C Assembler variant.
; .or is origin
; .as is ASCII String
; .hs is Hex String
.or $300
main ldy #$00
.1 lda str,y
beq .2
jsr $fded ; ROM routine, COUT, y is preserved
iny
bne .1
.2 rts
str .as "HELLO WORLD"
.hs 0D00
LP
June 8, 2014, 7:47pm
9
Re: Hello world! Examples of different languages
no
us1415
June 8, 2014, 7:50pm
10
Re: Hello world! Examples of different languages
Backbone.js
<!DOCTYPE html>
<html>
<head>
<**** charset="utf-8">
<title>hello-backbonejs</title>
</head>
<body>
<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script src="https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json2.js"></script>
<script src="http://underscorejs.org/underscore.js"></script>
<script src="http://backbonejs.org/backbone.js"></script>
<script>
(function($){
var MyView = Backbone.View.extend({
initialize: function(){
this.render();
},
render: function(){
$('body').append("<h4>hello world</h4>");
}
});
var myView = new MyView();
var myView = new MyView();
})(jQuery);
</script>
<div>test</div>
</body>
</html>
NaMaan
June 9, 2014, 12:57am
11
Re: Hello world! Examples of different languages
NodeJS
console.log('Hello World!!');
PHP
<?php echo 'Hell World!!'; ?>
C#
using System;
public class hello
{
public static void main(){
console.WriteLine("hello world!!");
}
}
NaMaan
June 9, 2014, 1:00am
12
Re: Hello world! Examples of different languages
JavaScript
<script>
alert('Hello World');
</script>
us1415
June 12, 2014, 3:49pm
13
Re: Hello world! Examples of different languages
COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world!'.
STOP RUN.
us1415
June 12, 2014, 3:50pm
14
Re: Hello world! Examples of different languages
Objective-C
#import <stdio.h>
#import <Foundation/Foundation.h>
int main(void)
{
NSLog(@"Hello, world!
");
return 0;
}
OYMWA
June 12, 2014, 4:50pm
15
Re: Hello world! Examples of different languages
*sh & dos
echo "hello world!";
perl ( hope not a repeat )
print "Hello World!";
print "
";
FORTRAN: ( yeah..used that when I was a chemical engineer )
!program hello
print *, 'Hello World'
end program hello
mo293
June 12, 2014, 5:09pm
16
Re: Hello world! Examples of different languages
English
"Hello World"
Russian
"привет мир"
:)
us1415
June 12, 2014, 7:20pm
17
Re: Hello world! Examples of different languages
Pascal:
program HelloWorld;
begin
WriteLn('Hello, world!');
end.
us1415
June 12, 2014, 7:20pm
18
Re: Hello world! Examples of different languages
PL/SQL
SET SERVEROUTPUT ON;
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello, world!');
END;
us1415
June 12, 2014, 7:21pm
19
Re: Hello world! Examples of different languages
Ruby:
puts "Hello, world!"
SID_NY
June 12, 2014, 7:41pm
20
Re: Hello world! Examples of different languages
Ahan, Even though its just hello world, looks like we've got some serious programmers here now on GS :)
now we are talking ;)