Absicht: statt
if ( 0 == x % 2 ) {
x = x / 2;
} else {
x = 3 * x + 1;
}
|
lieber
x = if ( 0 == x % 2 ) {
x / 2
} else {
3 * x + 1
} ;
|
historische Notation dafür
x = ( 0 == x % 2 ) ? x / 2 : 3 * x + 1;
?/: ist ternärer Operator