We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

REPL

REPL stands for "read-eval-print loop". It's a common type of program that allows for interactivity. You type in a command, and the program evaluates it and prints the result. You can then type in another command, and so on.

Your native terminal's command line is a REPL! Our Pokedex will also be a REPL. In this step, we're just going to build the bones of the REPL: a loop that parses and cleans an input and prints the first word back to the user. Here is what your program should be able to do after this step:

> go run .
Pokedex > help me
help
Pokedex > Exit
exit
Pokedex > WHAT even is a pokeman?
what

Pokedex > is our own custom command line prompt. The program waited and recorded my input (in the first instance, help me) and didn't continue until I pressed enter.

Assignment

wagslane@MacBook-Pro-2 pokedexcli % go run .
Pokedex > well hello there
Your command was: well
Pokedex > Hello there
Your command was: hello
Pokedex > POKEMON was underrated
Your command was: pokemon

You can terminate the program by pressing ctrl+c.

go run . | tee repl.log
  • Use this as the first input: CHARMANDER is better than bulbasaur.
  • Use this as the second input: Pikachu is kinda mean to ash.
  • Terminate the program by pressing ctrl+c.

Run and submit the CLI tests.