"연산자 not"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(다른 사용자 한 명의 중간 판 6개는 보이지 않습니다)
6번째 줄: 6번째 줄:
==Bash==
==Bash==
[[category: Bash]]
[[category: Bash]]
<source lang='bash'>
<syntaxhighlight lang='bash'>
A=1
A=1
echo $((A^1))
echo $((A^1))
# 0
# 0
</source>
</syntaxhighlight>
<source lang='bash'>
<syntaxhighlight lang='bash'>
A=0
B=0
echo $((A^1))
echo $((B^1))
# 1
# 1
</source>
</syntaxhighlight>
 
==Python==
[[category: Python]]
<syntaxhighlight lang='Python'>
print( not True )
print( not False )
# False
# True
</syntaxhighlight>


==Ruby==
==Ruby==
[[category: Ruby]]
[[category: Ruby]]
<source lang='Ruby'>
<syntaxhighlight lang='Ruby'>
puts !true
puts !true
# false
# false
puts !false
puts !false
# true
# true
</source>
</syntaxhighlight>
 
==같이 보기==
==같이 보기==
*[[and]]
*[[and]]
*[[or]]
*[[or]]
*[[bitwise NOT]]
*[[비트연산 NOT]]
*[[!=]]

2020년 11월 2일 (월) 02:31 기준 최신판

not
!

1 Bash[ | ]

A=1
echo $((A^1))
# 0
B=0
echo $((B^1))
# 1

2 Python[ | ]

print( not True )
print( not False )
# False
# True

3 Ruby[ | ]

puts !true
# false
puts !false
# true

4 같이 보기[ | ]

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