Nested while-s

Josh Tompkins josht at iname.com
Fri Jan 14 22:33:07 EST 2000


Is it not possible to nest while's?

Consider this code:

def listOfRadius(radius, xpos, ypos):
	list = []
	currentX = (xpos - radius)
	currentY = (ypos - radius)
	while currentX <= (xpos + radius):
	    while currentY <= (ypos + radius):
		    str1 = `currentX` + " , " + `currentY`
		    list.append(str1)
		    currentY = currentY + 1
	    currentX = currentX + 1
	return list

It will list only the values from the nested while.  It was supposed to 
increment the inner while until currentY <= (ypos + radius), and then 
increment the outer while (currentX), and then repeat the inner while's 
code, etc., etc., etc.  I'm not very good at explaining these things, so I 
hope you can see what I'm trying to do from the code.

Any help you can give me would be greatly appreciated.

TIA,

Josh "Josue" Tompkins
________________________________________________________________

"Destined For Great Things -- but pacing myself."
- From a t-shirt.

E-Mail:  josht at iname.com 
ICQ:  21219667 
Web:  http://www.crosswinds.net/~josht
_________________________________________________________________



More information about the Python-list mailing list