Ramana
Valued Contributor II

I tested with different levels of nesting and it is working as expected.

Here is the sample code:

 

import sys
bucket_name =  "prod"# str(sys.argv[1]).lower()

def main():
    i,j=0,0
    while j<=2:
        print(f"while loop iteration: {j}")
        for i in range(0,3):
            print(f"for loop iteratation: {i}")
            if bucket_name ==  "prod" and j==1 and i==1:
                print("Success. It is PROD. Existing with 0")
                return True
                print("After return")
            # Rest of your code
            else:
                # print("Fail. It is DEV. Existing with 1")
                # sys.exit(1)
                print(f"Else: while iteration: {j} and for iteration: {i}")
                continue
            print("outside if else")
            i+=1
            print("inside for loop")
        j+=1
        print("end of for loop")
    print("end of while loop")

if __name__ == "__main__":
    main()

 

 

Thanks
Ramana

View solution in original post