DEV Community

Discussion on: Why I'm phasing out ternary statements

Collapse
 
fennecdjay profile image
Jérémie Astor

I think we forgot the use for return statement:

//! return i or 0 if i is negative
static inline int full_rect(int i) {
  return i > 0 ? i : 0;
}

Also, since c99, one can write:

//! return i or 0 if i is negative
static inline int full_rect(int i) {
  return i > 0 ?: 0;
}

Which I love and also put in Gwion 😄