jashkenas--coffeescript/documentation/examples/modulo.coffee

5 lines
153 B
CoffeeScript

-7 % 5 == -2 # The remainder of 7 / 5
-7 %% 5 == 3 # n %% 5 is always between 0 and 4
tabs.selectTabAtIndex((tabs.currentIndex - count) %% tabs.length)