Skip to Main Content
Learn to Program with Minecraft
book

Learn to Program with Minecraft

by Craig Richardson
November 2015
Beginner to intermediate content levelBeginner to intermediate
320 pages
7h 49m
English
No Starch Press
Content preview from Learn to Program with Minecraft

8FUNCTIONS GIVE YOU SUPERPOWERS

image

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

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Minecraft Modding For Kids For Dummies

Minecraft Modding For Kids For Dummies

Sarah Guthals, Stephen Foster, Lindsey Handley
Minecraft Modding with Forge

Minecraft Modding with Forge

Aditya Gupta, Arun Gupta
Adventures in Minecraft, 2nd Edition

Adventures in Minecraft, 2nd Edition

David Whale, Martin O'Hanlon

Publisher Resources

ISBN: 9781457198823Errata Page