在python中强制结束递归函数的方法以下两种
1.使用return语句结束
def count(dict, key, depth):
if key is not None:
if key == 42:
return depth
return count(map, map[key][0], depth+1)
return count(map, map[key][1], 活动:慈云数据爆款香港服务器,CTG+CN2高速带宽、快速稳定、平均延迟10+ms 速度快,免备案,每月仅需19元!! 点击查看depth+1)
2.通过在递归函数外定义一个isGo全局变量结束
var isGo:Boolean=true
functionarr_all(pre:Array,nex:Array) {
if(isGo==false){return}
var j:uint=nex.length;
if (j==1) {
var t=[];
for (var i:uint=0;i
还没有评论,来说两句吧...