+ 6
Can if statement be nested infinitely?
11 ответов
+ 9
Nothing on a computer can be done infinitely. There is always a memory limit.
+ 6
~ swim ~ Is that about strictly nested if statements or could I have more by using functions?
For example that I have 200 nested if statement, that has a function call in the innermost if statement, and that function call could have 100 nested if statements?
Would it work fine?
+ 3
Yes, but it is not strictly practical to have lot of nested if statements.
+ 3
interesting question by Seb TheS
+ 3
In js, infinite loops crash my phone
+ 3
In Python the limit is given by the max indentation level, which generally is 100.
https://code.sololearn.com/cOZam70Q9Yuc/?ref=app
Try with this program: if you put NESTED-IFS to 100, you will receive an IndentationError. Instead, 99 is okay.
+ 2
Yep
+ 2
As long as your memory can handle it
+ 2
Yea it can, but you probably shouldn’t or 2 days later you won’t understand a thing from what you wrote...
+ 1
it wouldnt be very good practice though
0
Yes it can be but until the memory is there