ํฌ์ŠคํŠธ

๐ŸŒ’ ๋“œ๋ชจ๋ฅด๊ฐ„ ๋ฒ•์น™, De Morgan's Law

๐Ÿ’Ž ๋“œ๋ชจ๋ฅด๊ฐ„ ๋ฒ•์น™, De Morganโ€™s Law


not (A or B) = (not A) and (not B)
not (A and B) = (not A) or (not B)

๐Ÿ’Ž ์ด๋ฅผ ์ด์šฉํ•ด, ์ฝ๊ธฐ ์ข‹์€ ์ฝ”๋“œ ๋งŒ๋“ค๊ธฐ


1
2
3
4
5
// 1
if (!(file_exists && !is_protected))

// 2 (With De Morgan's Law)
if (!file_exists || is_protected)

2๋ฒˆ ์กฐ๊ฑด๋ฌธ์ด ๋” ์ฝ๊ธฐ ์‰ฝ๋‹ค !

์ด ๊ธฐ์‚ฌ๋Š” ์ €์ž‘๊ถŒ์ž์˜ CC BY 4.0 ๋ผ์ด์„ผ์Šค๋ฅผ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค.