Skip to main content
deleted 33 characters in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

Are the following IF statements acceptable? Checking opcode values

I haveWhat troubles me are the following code:empty /**/ brackets. Is there a cleaner way of handling this logic?

if (opcode == OP_0) { /* continue */}
    else if (opcode == OP_1NEGATE) { /* continue */}
    else if (opcode >= OP_1 && opcode <= OP_16) { /* continue */}
    else { throw new Exception("decodeFromOpN called on non OP_N opcode"); }

What troubles me are the empty /**/ brackets.

Is there a cleaner way of handling this logic?

Are the following IF statements acceptable?

I have the following code:

if (opcode == OP_0) { /* continue */}
    else if (opcode == OP_1NEGATE) { /* continue */}
    else if (opcode >= OP_1 && opcode <= OP_16) { /* continue */}
    else { throw new Exception("decodeFromOpN called on non OP_N opcode"); }

What troubles me are the empty /**/ brackets.

Is there a cleaner way of handling this logic?

Checking opcode values

What troubles me are the empty /**/ brackets. Is there a cleaner way of handling this logic?

if (opcode == OP_0) { /* continue */}
    else if (opcode == OP_1NEGATE) { /* continue */}
    else if (opcode >= OP_1 && opcode <= OP_16) { /* continue */}
    else { throw new Exception("decodeFromOpN called on non OP_N opcode"); }
Question Protected by rolfl
deleted 17 characters in body; edited tags
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

I have the following code:

    if (opcode == OP_0) { /* continue */}
        else if (opcode == OP_1NEGATE) { /* continue */}
        else if (opcode >= OP_1 && opcode <= OP_16) { /* continue */}
        else { throw new Exception("decodeFromOpN called on non OP_N opcode"); }

What troubles me isare the empty /**//**/ brackets.

Is there a cleaner way of handling the this logic?

I have the following code:

    if (opcode == OP_0) { /* continue */}
        else if (opcode == OP_1NEGATE) { /* continue */}
        else if (opcode >= OP_1 && opcode <= OP_16) { /* continue */}
        else { throw new Exception("decodeFromOpN called on non OP_N opcode"); }

What troubles me is the empty /**/ brackets.

Is there a cleaner way of handling the this logic?

I have the following code:

if (opcode == OP_0) { /* continue */}
    else if (opcode == OP_1NEGATE) { /* continue */}
    else if (opcode >= OP_1 && opcode <= OP_16) { /* continue */}
    else { throw new Exception("decodeFromOpN called on non OP_N opcode"); }

What troubles me are the empty /**/ brackets.

Is there a cleaner way of handling this logic?

Tweeted twitter.com/#!/StackCodeReview/status/443154982347739136
Source Link
makerofthings7
  • 713
  • 2
  • 8
  • 14

Are the following IF statements acceptable?

I have the following code:

    if (opcode == OP_0) { /* continue */}
        else if (opcode == OP_1NEGATE) { /* continue */}
        else if (opcode >= OP_1 && opcode <= OP_16) { /* continue */}
        else { throw new Exception("decodeFromOpN called on non OP_N opcode"); }

What troubles me is the empty /**/ brackets.

Is there a cleaner way of handling the this logic?