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
Post a Comment