09 — And / Or: combine conditions
Real conditions are often two questions. and needs both to be true; or
needs at least one.
Steps
Create
combine.nme:
run it →set ready to True set score to 5 if ready and score is greater than 2 then show GoBoth parts are true, so it prints
Go.Korean connects conditions with
그리고and또는:
run it →준비는 참 점수는 5 만약 준비 그리고 점수가 2보다 크면 성공 말해줘oronly needs one true side:
run it →준비는 참 기다림은 거짓 만약 준비 또는 기다림 그러면 기다려 말해줘andbinds beforeor, exactly like Python:
run it →만약 준비 그리고 기다림 또는 점수가 2보다 크면 성공 말해줘This means
(준비 and 기다림) or (점수 > 2).Combined conditions work in loops too:
run it →set ready to True set waiting to False while ready or waiting show Still working break end
Try it yourself
Show a welcome only when a name exists and the hour is late:
set name to Mina
set hour to 21
if name exists and hour is greater than 18 then show Good evening name!
run it →What you learned
and/그리고needs both conditions true.or/또는needs only one true.andbinds beforeor, like ordinary Python.- Conditions combine inside
if,만약, andwhilealike.