+ 2
How do we nest an if without using parentheses?
6 Respostas
+ 3
For what language? And @Jax, that's not a nested if - It's just a regular if statement
+ 3
# The loop body is determined by indentation, so inner 'if' statement is more indented than outer one:
if condition:
do something in the loop
start a new loop below
if condition:
new loop body start
do some stuff
loop body end when indentation removed
continuation of the outer loop
outer loop end when indentation removed
main flow continuation
+ 2
Like this?
x = 10
if x == 10:
print(‘hello’)
+ 2
x = 10
if x > 5:
if x < 20:
print ("I'm nested!")
Is this what you are asking?
+ 2
@user guru:
Language context is Python, curly brackets are not the subject here (appart the fact I believe the asker was confusing by talking about "parenthesis" instead of "curly brackets")...
0
for python