Exercise 2.2 – converting loops
In this exercise, we will convert a functioning
while loop into a
repeat loop. Both loops are very similar. In the Programming loops section, we explained the difference between both. Take a look at the following code snippet:
local spawnLocation = workspace.SpawnLocation while true do spawnLocation.Orientation += Vector3.new(0, 1, 0) task.wait() end
This code snippet rotates SpawnLocation in the Workspace. Feel free to run this script before you convert it.
- Convert the preceding code snippet into a
- What is different about the condition of the
repeatloop compared to the
whileloop, and why?