needmoreeasy EN 한국어
Learn

02 — Ask: have a conversation

★☆☆☆☆ (1/5)input
Prerequisites
01 — Hello
You will end up with
a program that asks a name and greets it in a sentence

A program that listens. ask reads what the user types and stores it in a name.

Steps

  1. Create greet.nme:

    ask name What is your name?
    show Hello name!
    
    run it →
  2. Run it and type a name when the program waits:

    nme run greet
    

    NME inserts the stored answer into the second sentence, so typing Mina prints Hello Mina!.

  3. The same conversation works in Korean:

    이름을 물어봐 이름이 뭐예요?
    안녕하세요 이름! 말해줘
    
    run it →
  4. For the gentlest first input, an ordinary question is enough — NME infers the name from the question:

    What is your name?
    Hello name!
    
    run it →

Try it yourself

Ask for a city and show it in a sentence:

ask city Which city do you live in?
show I love city!
run it →

What you learned

  • ask name question stores the typed answer as name; 물어봐 is the Korean action.
  • A known name is inserted into a later sentence automatically.
  • An ordinary question like What is your name? also creates the name.
  • show Hello name! prints Hello plus the stored value.

This page on GitHub