Hacker News new | ask | show | jobs
by cagey 738 days ago
A few decades ago I refactored a different way:

   // this may be a mistake!  English language is unorthogonal in the extreme!
   const char * Add_es( int count ) { return 1 == count ?  "" : "es"; }
   const char * Add_s(  int count ) { return 1 == count ?  "" : "s" ; }
(some English words pluralize with "es" suffix, most with "s"). It has proven surprisingly useful:

   Msg( "%d file%s updated when you switched back", updates, Add_s( updates ) );
Only difference vs example is mine prints "0" vs "no".