print rec(0,1,6,0) wait key function rec(start, cur, level, total) for i=start to 9 if cur < level then total = rec(i,cur+1,level,total) else inc total next i endfunction total