"함수 정의"의 두 판 사이의 차이

잔글 (Jmnote 사용자가 Function 문서를 함수 정의 문서로 옮겼습니다)
19번째 줄: 19번째 줄:
# hello
# hello
</source>
</source>
POSIX 호환 전용 셸의 경우 <code>greet() { ... }</code> 형태의 함수만 지원한다.


==JavaScript==
==JavaScript==

2018년 1월 15일 (월) 21:14 판

function
def

1 Bash

greet() {
	echo 'hello'
}
greet
# hello
function greet() {
	echo 'hello'
}
greet
# hello

POSIX 호환 전용 셸의 경우 greet() { ... } 형태의 함수만 지원한다.

2 JavaScript

function greet() {
	console.log("hello");
}
greet();
// hello
var greet = function() {
	console.log("hello");
}
greet();
// hello

3 PHP

function greet() {
	print("hello");
}
greet();
# hello

4 Python

def greet():
	print('hello')

greet()
# hello
def show_ answer():
	print(42)

show_answer()
# 42

5 Ruby

def greet
   puts "hello" 
end

greet
# hello

6 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}