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

7DANCE PARTIES AND FLOWER PARADES WITH WHILE LOOPS

image

Loops make it easy to repeat code again and again. Instead of copying and pasting the same code, you can use a loop to repeat the code as many times as you want. You’ll use loops in this chapter to make your programs repeat without having to rerun them. We’ll focus on one type of Python loop known as the while loop.

A Simple while Loop

You use while loops to repeat blocks of code. Similar to if statements, a while loop will execute the code inside it as long as a condition is True. That is, a condition must be met in order for the body of the statement to run.

The difference between a while loop ...

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