July 2017
Beginner to intermediate
420 pages
10h 56m
English
Another syntax is the while loop. This is kind of a standard looping syntax that you see in most languages:
x = 0while (x < 10): print (x), x += 1
The output of the previous code is as follows:
0 1 2 3 4 5 6 7 8 9
We can also say, start with x = 0, and while (x < 10):, print it out and then increment x by 1. This will go through over and over again, incrementing x until it's less than 10, at which point we break out of the while loop and we're done. So it does the same thing as this first example here, but just in a different style. It prints out the numbers 0 through 9 using a while loop. Just some examples there, nothing too complicated. Again, if you've done any sort of programming or scripting before, this should be ...
Read now
Unlock full access