以下是一个可变累积操作的示例吗?

huangapple go评论65阅读模式
英文:

Why is the following an example of a mutative accumulation operation?

问题

根据Java文档,以下是一个变异累积操作。有人可以解释一下什么是变异累积操作,以及它如何应用于以下代码片段吗?

int sum = 0;
for (int x : numbers) {
  sum += x;
}
英文:

According to Java docs, the following is a mutative accumulation operation. Can someone please explain what a mutative accumulation operation is and how does it apply to the following piece of code?

int sum = 0;
for (int x : numbers) {
  sum += x;
}

答案1

得分: 4

以下是翻译好的内容:

这些术语中每个单词的标准词典定义应该能让您大部分理解。

它是mutative,因为它会改变(更改/修改/等等)变量sum以得出结果。

它是accumulation,因为数字逐渐相加形成总和。

英文:

The standard dictionary definitions for each of those words in the term should get you most of the way to understanding.

It's mutative because it mutates (changes/alters/ etc) the variable sum to arrive at the result

It's an accumulation because the numbers are added to form the sum gradually

huangapple
  • 本文由 发表于 2020年9月1日 00:20:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/63674511.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定