for里的上一个/下一个下标的安全写法时间:2023-01-05 20:35:12const len:int=10; for(var:int=0;i<len;i++){ var previ:int=(i-1+len)%len; var nexti:int=(i+1)%len; }