November 2015
Beginner to intermediate
320 pages
7h 49m
English

Functions are reusable blocks of code that perform specific tasks. Say you want to write code that builds a tree in Minecraft. You could rewrite the tree-building code every time you need to use it in your program (or copy and paste it); however, this would be inefficient, especially if you wanted to change it.
Instead of copying and pasting, you could write the tree-building code as a function. Recall that we used some functions in earlier chapters: str(), input(), and int(). They’re all functions that are built into Python. You’ve even been using Minecraft functions, such as the getBlocks() and setPos() functions, ...