I think the code you posted (first version) is the most readable version of what you're trying to do, and that's really more important than getting your code smaller.
The only thing I would change is, as jmoreno suggested as jmoreno suggested, use a variable to hold the ticks
and then add or subtract depending on the value of inverted
. But I would keep the if
blocks as you have them in the first version of your code.
I think the code you posted (first version) is the most readable version of what you're trying to do, and that's really more important than getting your code smaller.
The only thing I would change is, as jmoreno suggested, use a variable to hold the ticks
and then add or subtract depending on the value of inverted
. But I would keep the if
blocks as you have them in the first version of your code.
I think the code you posted (first version) is the most readable version of what you're trying to do, and that's really more important than getting your code smaller.
The only thing I would change is, as jmoreno suggested, use a variable to hold the ticks
and then add or subtract depending on the value of inverted
. But I would keep the if
blocks as you have them in the first version of your code.
I think the code you posted (first version) is the most readable version of what you're trying to do, and that's really more important than getting your code smaller.
The only thing I would change is, as jmoreno suggested , use a variable to hold the ticks
and then add or subtract depending on the value of inverted
. But I would keep the if
blocks as you have them in the first version of your code.
I think the code you posted (first version) is the most readable version of what you're trying to do, and that's really more important than getting your code smaller.
I think the code you posted (first version) is the most readable version of what you're trying to do, and that's really more important than getting your code smaller.
The only thing I would change is, as jmoreno suggested , use a variable to hold the ticks
and then add or subtract depending on the value of inverted
. But I would keep the if
blocks as you have them in the first version of your code.