Jun-08-2021, 10:48 PM
(This post was last modified: Jun-09-2021, 06:15 PM by davidorlow.)
I'm following along with the MIT online course. I am a very elementary programmer, but I have some really basic knowledge of c++ and c#. Then I have a little more in depth knowledge of Powershell. I've been writing scripts in Powershell for about a year now. But, with any loop, typically you do something like this...
for (i=0; i<5; i++) {
do this first
do this second
do this third
}
But, I put in curley braces to contain the loop. Curley braces or parenthesis don't seem to work at all in Python. I tried adding them to a loop and I got an error. How does it know where the loop ends and the next code not part of the loop starts? Is it done purely on indentation?
for (i=0; i<5; i++) {
do this first
do this second
do this third
}
But, I put in curley braces to contain the loop. Curley braces or parenthesis don't seem to work at all in Python. I tried adding them to a loop and I got an error. How does it know where the loop ends and the next code not part of the loop starts? Is it done purely on indentation?