Bug or Feature
I'm brand spanking new to this language, though I have coded in Python. When I was testing this language out, I noticed that my code didn't work when I indented the block of a while loop. This seemed a little strange, and a little different from the traditional Python programming syntax.
Was this a bug or a feature? Am I insane for noticing this, or am I a genius?
9 Replies
can you provide a code example? While loops should be indented just like in normal python and I've never had the issue you're describing
Here is the main function. There are some other issues with the code right now but the while loop is working correctly. Before posting the question, I confirmed that adding indentation raised an indentation error. Again, I'm really new to this language so I'm still learning a lot. Hope this helps in your analysis.
Are you using an IDE to write your code?
negative, I'm using VS code.
I consider that an IDE, but anyway that's not the important thing
I just wanted to check that you're using a tool that handles tabs vs spaces correctly etc
sounds like you are
Like I said, I'm uber noob. So I'm sure something was off.
Congrats @christian_drake, you just advanced to level 1!
I'm not sure why you're having problems with indentation, but this isn't an intentional divergence from Python, so if you can come up with an example that I can replicate, I can explore this further
When I copy your code snippet into my own VSCode editor, I need to indent the body of the while loop, as you'd expect
otherwise I get a syntax error
maybe try creating a fresh file, and typing out the code again
see if you can replicate this yourself
Yeah, I erased that code and tried a different algorithm and the while loop needed the proper indentation. I just picked up this language like a day ago, so when that happened my mind exploded.