V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  Ainokiseki  ›  全部回复第 2 页 / 共 2 页
回复总数  21
1  2  
2023 年 11 月 23 日
回复了 Ainokiseki 创建的主题 程序员 和 mentor 代码习惯不一样,好头痛
@idealhs 我举个例子:某段代码要对数组中最后一个元素做特殊处理,我写的是:
```
for i:=range array{
if i==len(array)-1{
// do sth special
}
}
```
mentor 要我改成:
```
for i:=0;i<len(array-1);i++{
// do sth normal
}
// do sth special for array[len(array)-1]

```
1  2  
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5543 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 27ms · UTC 08:25 · PVG 16:25 · LAX 01:25 · JFK 04:25
♥ Do have faith in what you're doing.