Nested while-s

William Park parkw at better.net
Fri Jan 14 22:44:00 EST 2000


On Sat, Jan 15, 2000 at 03:33:07AM +0000, Josh Tompkins wrote:
> 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):

	    currentY = (ypos - 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
> _________________________________________________________________
> -- 
> http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list