Students learn about "procedures" in the second level of Lightbot. Players in Lightbot must use procedures when they don’t have enough space in the MAIN block to solve a problem. Procedures are helpful when you want to re-use a set of commands multiple times. When a P1 icon is run, all the commands in PROC1 are executed, and at the end of PROC1, the program runs the commands following the P1 icon.This is much like procedures or functions in a typed programming language. Procedures are useful for re-using code and extracting out code that would otherwise be duplicated in a program, or that deals with a specific set of actions. To illustrate this concept, we defined a classroom P1 and P2.
| Here is a video describing how procedures work using Lightbot Hour of Code. It also demonstrates solutions 2-1 and 2-5. |
0 Comments
Leave a Reply. |
GalleryLinks to the students work Useful LinksArchives
May 2015
Categories |