연산자 or

or
||

1 Bash[편집]

if [ 3 == 3 ] || [ 3 == 3 ]; then echo 'Yes'; else echo 'No'; fi
# Yes
if [ 3 == 3 ] || [ 3 == 5 ]; then echo 'Yes'; else echo 'No'; fi
# Yes
if [ 3 == 5 ] || [ 3 == 5 ]; then echo 'Yes'; else echo 'No'; fi
# No

2 JavaScript[편집]

// true
true || true;
true || false;
false || true;

// false
false || false;

3 Python[편집]

print( True or True )
print( True or False )
print( False or True )
print( False or False )
# True
# True
# True
# False
print( True | True )
print( True | False )
print( False | True )
print( False | False )
if 1==1 or 2==2 : print( True )
else: print( False )
# True

if 1==1 | 2==2 : print( True )
else: print( False )
# False

if 1==( 1 | 2 )==2 : print( True )
else: print( False )
# False

4 Ruby[편집]

puts true || true
# true
puts true || false
# true
puts false || true
# true
puts false || false
# false

5 SQL[편집]

5.1 MySQL[편집]

SELECT 0 || 0; 
SELECT 0 || 1; 
SELECT 1 || 0; 
SELECT 1 || 1; 
# 0
# 1
# 1
# 1
SELECT false || false; 
SELECT false || true; 
SELECT true || false; 
SELECT true || true; 
# 0
# 1
# 1
# 1

6 같이 보기[편집]

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