TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Where to start counting, 0 or 1?

3 点作者 joseakle大约 16 年前
My hypothesis: It's more usual to start with 0 when counting steps and with 1 when counting things.<p>Maybe that's why programmers start with 0, they usually count steps. Age also starts at 0, nobody is born being 1 year old, although we are living our 1st year of life. Races also start at 0. When you want to know how many eggs are in the basket it makes little sense to say, oh i have an empty basket, 0 eggs, let's add some, now i have 1 egg, 2 eggs, etc.

4 条评论

dkokelley大约 16 年前
When my littlest brother was learning to count, he would count the first object twice (0, 1) then continue as normal.<p>Honestly, it depends on the situation, and I think you got it right. Things start at 1, steps start at 0.<p>But starting at 0 presents a problem. If I have a set of stairs with 5 steps, I either count the ground or the landing in my steps but never both. If I want to get to the middle (3rd) step, if I'm at the bottom I just count 1, 2, 3 steps and I'm there, but if I'm at the top I only count 2 steps down. There are really 6 positions I could be, but only 5 steps. You guys may have this down, but it still trips me up sometimes.
blgraves大约 16 年前
Age starts at 1 in some countries. I know this is the case in both Taiwan and the Philippines, not sure where else. Someone who is 10 in the U.S. would be considered 11 there.
评论 #492861 未加载
trjordan大约 16 年前
Dijkstra argues 0.<p><a href="http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html" rel="nofollow">http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EW...</a>
rubentopo大约 16 年前
In my opinion, convention means nothing.<p>Do what makes sense according to the problem you're solving.