1. JavaScript
8. C
).listen 8000
<!DOCTYPE HTML>
<html>
<body>
<p>Before the script...</p>
<script>
alert( 'Hello, world!' );
</script>
<p>...After the script.</p>
</body>
</html>
2. Java
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}
3. Python
# This program prints Hello, world!
print('Hello, world!')
4. CSS
<style type="text/css">
h1 {
color: DeepSkyBlue;
}
</style>
<h1>Hello, world!</h1>
5. PHP<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
6. Ruby
puts 'Hello, world!' # Print out "Hello world"
7. C++
|
|
#include <stdio.h>
int main()
{
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}
9. Shell#!/bin/bash
echo "Hello, World!"
echo "Knowledge is power."
10. C#
// Hello1.cs
public class Hello1
{
public static void Main()
{
System.Console.WriteLine("Hello, World!");
}
}
11. Objective-C
#import <Foundation/Foundation.h>
@interface SampleClass:NSObject
- (void)sampleMethod;
@end
@implementation SampleClass
- (void)sampleMethod{
NSLog(@"Hello, World! \n");
}
@end
int main()
{
/* my first program in Objective-C */
SampleClass *sampleClass = [[SampleClass alloc]init];
[sampleClass sampleMethod];
return 0;
}
12. R
# My first program in R Programming
myString <- "Hello, World!"
print ( myString)
13. VimL
:echo "Hello, world!"
14. Go
package main
|
|
import "fmt"
|
|
func main() {
fmt.Println("hello world")
}
|
15. Perl
#!/usr/bin/perl
#
# The traditional first program.
# Print a message.
print "Hello, World!\n";
16. CoffeeScript
http = require "http" |
http.createServer( (req, res) -> |
body = "Hello World!" |
headers = |
'Content-Type': "text/plain" |
'Content-Length': body.length |
res.writeHead 200, headers |
res.end body, 'utf8' |
17. TeX
\documentclass[12pt]{article}
\begin{document}
Hello world!
$Hello world!$ %math mode
\end{document}
18. Swift
@IBAction func saySomethingTapped(sender: UIButton) {
displayLabel.text = "Hello World!"
}
19. Scala
object HelloWorld {
/* This is my first java program.
* This will print 'Hello World' as the output
*/
def main(args: Array[String]) {
println("Hello, world!") // prints Hello World
}
}
20. Emacs Lisp;;; This function simply returns the string Hello World that is in quotes.
(DEFUN HELLO ()
"HELLO WORLD"
)
21. Haskell
main = putStrLn "Hello, World"
22. Lua
print("Hello World!")
23. Clojure(defproject hello-world "0.1.0-SNAPSHOT"
:main hello-world.core
:dependencies [[org.clojure/clojure "1.5.1"]])
24. Matlabfunction y = hello_world %#codegen
y = 'Hello World!';
25. Arduino
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
26. Makefile
CC=gcc
CFLAGS=-Wall
main: main.o hello_fn.o
clean:
rm -f main main.o hello_fn.o
27. Groovy
println "Hello world!"
28. Puppet class helloworld {
notify { 'hello, world!': }
}
29. Rust
// This is the main function
fn main() {
// The statements here will be executed when the compiled binary is called
// Print text to the console
println!("Hello World!");
}
30. PwerShell
$strString = "Hello World"
write-host $strString
Functional Programming Languages
- Scala
- Clojure
- Haskell
- Python
- PHP
- Ruby
No comments:
Post a Comment