Skip to content
Discussion options

You must be logged in to vote

@LPenny-github

你好 😊


            int currentIndex = i % inputNumbers.Length;

我不覺得 currentIndex 有什麼問題,但因為其使用情景很簡單(simple):

  • 「陣列索引變數」是極常見的觀念
  • 此變數的生命週期是在連續的 4~5 行程式碼區塊內
  • 此變數沒有參與其它的運算,就單純作為「陣列索引」用途

若改成以下名字,也是可以的:

  • inputNumbersIndex
  • index
  • j

其它的變數名稱我覺得都 ok 👌

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LPenny-github
Comment options

Answer selected by LPenny-github
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants