Ángel

@angel@triptico.com



curmudgeon / cascarrabias

No twitter / no facebook / no instagram / no tiktok / no regrets
wwwhttps://triptico.com
geminigemini://triptico.com
tilde.clubhttps://tilde.club/~angel/
Ann Hell Musichttps://exode.me/accounts/annhell
Keyoxidehttps://keyoxide.org/hkp/1AFAE6809099EB5CD65A4E32B498DDC28F4584FF
YO NO SOY PAVEL (novela)https://distrito93.com/catalogo/yo-no-soy-pavel/
0 ★ 2 ↺

Ángel »
@angel@triptico.com

If you program in C, you've probably used what is called the ternary operator a million times in expressions like this:

    value = user_value ? user_value : default_value;
Where you test user_value and, if it's non-zero, you store it in value; otherwise, you set value to default_value.

What you may not know is that, thanks to a gcc (and others) extension, you can abridge that expression to this:

    value = user_value ?: default_value;
This ?: thing is colloquially named the 'Elvis' operator (if you don't see why, just look at it with you head slightly slanted to the left).

https://en.wikipedia.org/wiki/Elvis_operator

History