Shorten This Code with... blocks? I think this code cannot be shortened much, especially because I only consider two cases. But maybe there's a language construct that I don't know that would help.

if (subControl.inverted) {
    newValue = subControl.value+(float)(1.0f/(float)subControl.decorator.ticks);
    if (newValue &gt; 1)
        newValue = 0;
} else {
    newValue = subControl.value-(float)(1.0f/(float)subControl.decorator.ticks);
    if (newValue &lt; 0)
        newValue = 1;
}


Some of the (floats) are gratuitous, which is irrelevant.

Edit: The code could look like this, which helps. However, I guess this is the result of reading the answers already ;)

if (subControl.inverted) {
    newValue = subControl.value+(float)(1.0f/(float)subControl.decorator.ticks);
} else {
    newValue = subControl.value-(float)(1.0f/(float)subControl.decorator.ticks);
}

if (newValue &gt; 1)
    newValue = 0;
if (newValue &lt; 0)
    newValue = 1;
Not a lot shorter, but a bit...

float ticks = (float)(1.0f/(float)subControl.decorator.ticks);
newValue = subControl.value + subControl.inverted ? ticks : - ticks;

if (subControl.inverted &amp;&amp; newValue &gt; 1)  {
    newValue = 0;
} else if (!subControl.inverted &amp;&amp; newValue &lt; 0){
    newValue = 1;
}


You could make it even shorter if the you are restricting the values to just 0 and 1.

EDIT: you say in a comment, that it should be between 0 and 1, so...

if (newValue &gt; 1)  {
    newValue = 0;
} else if (newValue &lt; 0){
    newValue = 1;
}


Which is fewer characters if not fewer lines, and imo clearer in intent.