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 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.

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest