c# - Is there a situation in which using `i <= 2` in place of `i < 3` in loops would cause a change in behavior of the loop? -


this silly question. lot of data extrapolation for loops in applications. in cases tend find i <= 2 easier read/interpret i < 3. based on know should mean same thing, i'm wondering if there special cases evaluated differently when used in for loop. example, if used ++i instead of i++.

provided i integer, expressions i<=2 , i<3 should identical in function.
(they may different in terms of speed performance)

if i has type float, double, decimal, or related, value of 2.3 fail first test, pass second test.

if overload operator< or operator<=, make possible.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -