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
Ryulord
Ryulord3mo ago
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
christian_drake
christian_drakeOP3mo ago
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.
fn main():
var stack = Stack()
for i in range(100):
stack.push(i)
stack.peek()
while not stack.is_empty():
stack.pop()
stack.peek()
fn main():
var stack = Stack()
for i in range(100):
stack.push(i)
stack.peek()
while not stack.is_empty():
stack.pop()
stack.peek()
Again, I'm really new to this language so I'm still learning a lot. Hope this helps in your analysis.
Nick!
Nick!3mo ago
Are you using an IDE to write your code?
christian_drake
christian_drakeOP3mo ago
negative, I'm using VS code.
Nick!
Nick!3mo ago
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
christian_drake
christian_drakeOP3mo ago
Like I said, I'm uber noob. So I'm sure something was off.
ModularBot
ModularBot3mo ago
Congrats @christian_drake, you just advanced to level 1!
Nick!
Nick!3mo ago
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
christian_drake
christian_drakeOP3mo ago
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.

Did you find this page helpful?