I see code like this for example in Python:
if cnt > 0 and len(aStr) > 1:
while cnt > 0:
aStr = aStr[1:]+a
FYI: it looks like you might have an infinite loop in your example...
if cnt > 0 and len(aStr) > 1:
while cnt > 0:
aStr = aStr[1:]+aStr[0]
cnt += 1
cnt
is greater than 0cnt
is greater than 0cnt
by 1The net result is that cnt
will always be greater than 0 and the loop will never exit.