Shortest conditional to run a specific statement: C code golf
if(x!=y)printf("foo\n");
x!=y?printf("foo\n"):0;
x==y||printf("foo\n");


Yes, you can save some characters with the ternary operator or with the shortcutting logic operators (&amp;&amp; and ||).  All three of the above do the same thing.  Which you can use depends on things like the return type of printf and whether you need the return value.

Does that answer your question?