m (Gaon12님이 Hello world! 문서를 Hello, world! 문서로 이동했습니다: 오탈자 수정) |
(bash, c#, dart, fortran, html, java, kotlin, ruby 추가) |
||
26번째 줄: | 26번째 줄: | ||
==각 언어로 표현한 Hello, world!== | ==각 언어로 표현한 Hello, world!== | ||
===Bash=== | |||
<syntaxhighlight lang='bash'> | |||
#!/bin/bash | |||
echo "Hello, world!" | |||
printf "Hello, world!" | |||
</syntaxhighlight> | |||
===C=== | ===C=== | ||
<syntaxhighlight lang='C'> | <syntaxhighlight lang='C'> | ||
43번째 줄: | 51번째 줄: | ||
int main(int argc, char* argv[]) { | int main(int argc, char* argv[]) { | ||
std::cout << "Hello | std::cout << "Hello, world!" << std::endl; | ||
return 0; | return 0; | ||
} | |||
</syntaxhighlight> | |||
===C#=== | |||
<syntaxhighlight lang='c#'> | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace Hello_World | |||
{ | |||
class Program | |||
{ | |||
static void Main(string[] args) | |||
{ | |||
Console.WriteLine("Hello, world!"); | |||
} | |||
} | |||
} | |||
</syntaxhighlight> | |||
===Dart=== | |||
<syntaxhighlight lang='dart'> | |||
void main(){ | |||
print("Hello, world!"); | |||
} | |||
</syntaxhighlight> | |||
===Fortran=== | |||
<syntaxhighlight lang='fortran'> | |||
program Helloworld | |||
print *,"Hello, world!" | |||
end program | |||
</syntaxhighlight> | |||
===HTML=== | |||
<syntaxhighlight lang='html'> | |||
<!DOCTYPE HTML> | |||
<html> | |||
<head> | |||
<title>Hello!</title> | |||
</head> | |||
<body> | |||
<p>Hello, world!</p> | |||
</body> | |||
</html> | |||
</syntaxhighlight> | |||
===Java=== | |||
<syntaxhighlight lang='java'> | |||
public class HelloWorld { | |||
public static void main(String[] args) { | |||
System.out.println("Hello, world!"); | |||
} | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
54번째 줄: | 118번째 줄: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== | ===Kotlin=== | ||
<syntaxhighlight lang=' | <syntaxhighlight lang='kotlin'> | ||
fun main() { | |||
println("Hello, world!") | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
62번째 줄: | 128번째 줄: | ||
<syntaxhighlight lang='PHP'> | <syntaxhighlight lang='PHP'> | ||
<?php | <?php | ||
echo "Hello, world"; | echo "Hello, world!"; | ||
?> | ?> | ||
</syntaxhighlight> | |||
===Python=== | |||
<syntaxhighlight lang='python'> | |||
print('Hello, world!') | |||
</syntaxhighlight> | |||
===Ruby=== | |||
<syntaxhighlight lang='ruby'> | |||
puts "Hello, world!" | |||
print "Hello, world!" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==분기== | ==분기== | ||
{{분기|도움말:위키 문법/SyntaxHighlight|85572||가온 위키}} | {{분기|도움말:위키 문법/SyntaxHighlight|85572||가온 위키}} |
2022년 1월 6일 (목) 16:44 기준 최신판
#include <stdio.h>
int main()
{
printf("Hello, world!");
return 0;
}
#include <stdio.h>
int main()
{
printf("안녕 세상아!");
return 0;
}
컴퓨터 언어들에서 가장 기본으로 배우는 내용인 Hello, world!에 대해 다룬다. 거의 모든 프로그래밍 책들은 국룰로 처음에 Hello, world!로 시작하며, 이는 데니스 리치가 쓴 책인 "The C Programming Language" 교재의 첫 번째 예제가 화면이 "Hello, world!"를 출력하는 것이었기 때문이었다.
각 언어로 표현한 Hello, world![편집 / 원본 편집]
Bash[편집 / 원본 편집]
#!/bin/bash
echo "Hello, world!"
printf "Hello, world!"
C[편집 / 원본 편집]
#include <stdio.h>
int main()
{
printf("Hello, world!");
return 0;
}
C++[편집 / 원본 편집]
#include <iostream>
int main(int argc, char* argv[]) {
std::cout << "Hello, world!" << std::endl;
return 0;
}
C#[편집 / 원본 편집]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hello_World
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, world!");
}
}
}
Dart[편집 / 원본 편집]
void main(){
print("Hello, world!");
}
Fortran[편집 / 원본 편집]
program Helloworld
print *,"Hello, world!"
end program
HTML[편집 / 원본 편집]
<!DOCTYPE HTML>
<html>
<head>
<title>Hello!</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
Java[편집 / 원본 편집]
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
JavaScript[편집 / 원본 편집]
document.write("Hello, world!")
Kotlin[편집 / 원본 편집]
fun main() {
println("Hello, world!")
}
PHP[편집 / 원본 편집]
<?php
echo "Hello, world!";
?>
Python[편집 / 원본 편집]
print('Hello, world!')
Ruby[편집 / 원본 편집]
puts "Hello, world!"
print "Hello, world!"