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

43번째 줄: 43번째 줄:
[[category: Python]]
[[category: Python]]
<source lang='Python'>
<source lang='Python'>
def sayhello():
def greet():
print("hello")
print('hello')
sayhello()
 
greet()
# hello
# hello
</source>
</source>
<source lang='Python'>
<source lang='Python'>
def answer():
def show_ answer():
return 42
print(42)
 
show_answer()
# 42
</source>
</source>



2014년 8월 21일 (목) 10:14 판

function
def

1 Bash

function sayhello () {
	echo "hello"
}
sayhello
# hello

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 sayhello
   puts "hello" 
end
sayhello
# hello

6 같이 보기

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