needmoreeasy EN 한국어
Learn

09 — And / Or: combine conditions

★★☆☆☆ (2/5)conditions
Prerequisites
08 — Break
You will end up with
a program that judges combined conditions

Real conditions are often two questions. and needs both to be true; or needs at least one.

Steps

  1. Create combine.nme:

    set ready to True
    set score to 5
    if ready and score is greater than 2 then show Go
    
    run it →

    Both parts are true, so it prints Go.

  2. Korean connects conditions with 그리고 and 또는:

    준비는 참
    점수는 5
    만약 준비 그리고 점수가 2보다 크면 성공 말해줘
    
    run it →

    or only needs one true side:

    준비는 참
    기다림은 거짓
    만약 준비 또는 기다림 그러면 기다려 말해줘
    
    run it →
  3. and binds before or, exactly like Python:

    만약 준비 그리고 기다림 또는 점수가 2보다 크면 성공 말해줘
    
    run it →

    This means (준비 and 기다림) or (점수 > 2).

  4. Combined conditions work in loops too:

    set ready to True
    set waiting to False
    while ready or waiting
        show Still working
        break
    end
    
    run it →

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.
  • and binds before or, like ordinary Python.
  • Conditions combine inside if, 만약, and while alike.

This page on GitHub