if

Jmnote (토론 | 기여)님의 2017년 6월 21일 (수) 18:24 판 (→‎같이 보기)

1 Bash

  다른 뜻에 대해서는 Bash if 문서를 참조하십시오.
He="John Smith"
if [ "$He" = "John Smith" ]; then
	echo "He is John Smith"
else
	echo "He is not John Smith"
fi
# He is John Smith

2 CMD

set my_name=John Smith
IF "%my_name%"=="John Smith" ECHO my_name is John Smith

3 PHP

if(43>42) {
	echo('hello');
	echo('world');
}
// helloworld
if(43>42) echo('hello');
// hello

4 Python

if 43 > 42:
	print('hello')
	print('world')
# hello
# world
if 43 > 42: print ('hello')
# hello

5 Ruby

if 43 > 42
	print 'hello'
end
# hello
  • one-line
print 'hello' if true
# hello
print 'world' if false

6 같이 보기

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