golfscript

golfscript nested while loops

家住魔仙堡 提交于 2019-12-11 12:50:05
问题 Are nested while loops broken in golfscript or do I not know how to use them? I want to iterate Q from 5 to 0, and for each iteration, iterate Z from 10 to 0. The single loops work well separately, and they seem self-contained (not relying on the stack between operations): 5:Q; {"Q:"Q+ p Q} { Q 1- :Q; }while 10:Z;{"Z:"Z+ p Z}{Z 1- :Z;}while Output: "Q:5" "Q:4" "Q:3" "Q:2" "Q:1" "Q:0" "Z:10" "Z:9" "Z:8" "Z:7" "Z:6" "Z:5" "Z:4" "Z:3" "Z:2" "Z:1" "Z:0" But if I put the Z loop inside the Q loop,