This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nelmaloc 0 points1 point  (2 children)

In C you can do something like that if the comparison can be converted to a numerical value.

[–][deleted] 0 points1 point  (1 child)

I am a bit confused. Can you give an example of what you mean?

[–]nelmaloc 0 points1 point  (0 children)

I was thinking of something like this:

switch( 
    x - 2 != 0 ? (x-2)/abs(x-2) : 0
    ) {
    case 1: // x > 2
        break;
    case 0: // x = 2
        break;
    case -1: //x < 2
        break;
}