0
Explanation needed
int result = 0 for (int i = 0; i < 5; i++) { if i == 3 { result += 10 } else { result += i } } System.out.printIn(result); 17 Why result is 17 — could you explain please
2 Antworten
+ 1
i=0 else > res=0
i=1 else > res=1
i=2 else > res=3
i=3 if > res =13
i=4 else > res = 17
end
+= adds right value to left.
+ 1
Thanx!