Hey! I'm glad to be part of this learning community.
I'm a complete beginner in coding, and so I downloaded the app you guys made for teaching the basics; however I've been stuck on this lesson.
Not really because I don't understand the while loops themselves, but because I don't understand what cell is, how it has x and y built into it and how there's even a board_size function. Any help at explaining this would be perfect :D
#While Loops and the Cell Example in the app
4 messages · Page 1 of 1 (latest)
I believe cell is the grid that the objects are moving on.
They have an X and Y value.
that board_size function is from the previous tutorial you did, you just can't see it. It's a continuation of your previous work. It's a custom, pre-defined function.
A while loop is a type of control flow statement that allows you to repeatedly execute a block of code as long as a certain condition is met. The basic structure of a while loop is as follows:
while (condition):
# code to execute
When the program encounters a while loop, it first evaluates the condition. If the condition is true, the code inside the loop is executed. Once the code inside the loop is finished, the program goes back to the beginning of the loop and re-evaluates the condition. If the condition is still true, the code inside the loop is executed again, and this process repeats.
As soon as the condition becomes false, the program exits the loop and continues executing the code that comes after the loop.
An example of a while loop that counts down from 10 to 0:
count = 10
while (count >= 0):
print(count)
count = count - 1