DEV Community

Discussion on: This simple math hack lets you create an image carousel without any if statements

 
ranewallin profile image
Rane Wallin

Nothing wrong with it at all. My point was that you still have an if statement, it's just in a different place. The only way to eliminate it would be if there were two completely different button components, one for forward and one for back, that called different code, which would then be less dry. I wasn't saying there was anything wrong with what you posted :).