What Are Methods in Codehs
Codehs Glossary Defining a Method Means to Teach the Computer a New Command and Explain What It Should Do When Receiving That Command. How Do You Call a Method...
CodeHS Glossary Defining a method means to teach the computer a new command and explain what it should do when receiving that command.
How do you call a method in CodeHS?
As opposed to defining a method, calling a method actually runs code. In order to call a method, you must define it first, so the computer knows what to do. When you just define a method, it does not run any of the commands inside it. You need to actually call the method where you want the commands to actually run.
How did we use methods in our Karel program?
A method is a way to teach Karel a new word, or a new command. Methods allow us to break our program down into smaller parts and make it easier to understand. A program with many smaller methods is easier to read and fix than a program with one very large method.