Where exactly? Do you mean i = i + 1;? Yes, that would be the same statement – producing the same result. You could also use i += 1; so you spare one character you don’t have to type (i) – this is used in Python for example, because Python doesn’t use ++ operator for increment, it doesn’t know ++ operator in fact. But it turns out programmers are lazy and increment by one is so often used that some programming languages (such as C or C++) defines ++ operator as even a quicker way to increment by one.
Where exactly? Do you mean
i = i + 1;
? Yes, that would be the same statement – producing the same result. You could also usei += 1;
so you spare one character you don’t have to type (i
) – this is used in Python for example, because Python doesn’t use++
operator for increment, it doesn’t know++
operator in fact. But it turns out programmers are lazy and increment by one is so often used that some programming languages (such as C or C++) defines++
operator as even a quicker way to increment by one.