+ 1
Is it too long ???
4 ответов
+ 2
As long as it works, it shouldn't be too long.
0
You have a lot of duplicate code. Putting it in a function that is called in both places would make it easier to get running initially and maintain in the future. However, as Learnsolo stated working is more important than length.
- 1
@<Learnsolo> The longer the code, the more likely you will encounter instruction cache misses ;(
- 1
Too long? no; as long as it works - just like @<Learnsolo> said. refactoring the code, e.g. into function like @John Wells suggest help with ease of read, easier to maintain & reduce programming mistake; modern compilers will automatically refactor the code to optimise it's execution when it compiles your code.