지난 글에 이어서 조건문이 여러개일 때를 살펴봅니다.

- else if는 else에 if를 더한 것입니다. 즉, 이 if가 false일 때 한가지 condition을 추가해줍니다.
- if문이 true이면 console.log("Plase write a number");가 실행되고, 이 condition(age < 18)이 false면, javascript는 이 condition을 확인합니다. true이면 console.log("You are too young");가 실행되고, false이면 console.log("You can drink");가 실행됩니다.


두가지 조건을 동시에 확인하기
예) 하나는 age가 18보다 큰지, 하나는 50보다 작은지
- ||는 OR이라는 것이다. 둘 중 하나만 true인지 확인하는 것이다.
- OR은 하나가 true이고 하나가 false이면 true가 된다.
- OR은 둘 다 true이면 true가 된다.
- OR은 둘 다 false이면 false가 된다.
- &&는 AND라는 것이다.
- AND는 둘 다 true여야만 한다.
예외인 경우가 하나 있는데, 그것은 음수(-인 수)를 입력할 때는 제대로 된 결과가 출력되지 않는다는 것입니다.
이 때는 사용자에게 양수(+인 수)를 입력하라고 해야합니다.
그러기 위해서는 OR 연산자를 쓴다.



중복되는 결과의 사진은 추가하지 않았습니다! 전 포스트를 참고하시면 될 것 같습니다!