While loop example question

For the example below, “perform_command(command)” wasn’t defined anywhere, why is it okay to be included in the body of process_user_input?

def process_user_input
command = get_user_input
while command != “quit”
perform_command(command) #I don’t understand this line, perform_command(command) was never defined…

command = get_user_input


puts “Good bye!”

Hi Jing,

This is just pseudo code, so perform_command isn’t an actual method. It’s just an example of how you would use a while loop to execute some command while the condition is met.

get_user_input is also pseudo code. It’s a stand-in for a method that would get the user input from the terminal and return it.

1 Like