Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Timeline for Tips for code-golfing in C#

Current License: CC BY-SA 3.0

10 events
when toggle format what by license comment
Aug 19, 2020 at 20:23 comment added Zuabros If you won't need the variable again, you can use: while(max-->0) { foo;}
Nov 10, 2017 at 23:02 comment added jcolebrand Okay so change it?
Nov 10, 2017 at 22:52 comment added Ayb4btu I like changing for(;i<max;) to while(i<max). Same number of bytes, but for me it just looks cleaner.
Jul 4, 2016 at 3:39 comment added recursive You can move both declarations back into the for clause for a1 byte savings.
Dec 7, 2011 at 15:09 comment added Joey ICR: depends on whether you can put another (earlier) statement into the for header as well, which would then save a character again.
Dec 7, 2011 at 14:17 comment added ICR @Joey In those cases I tend to switch to while(++i<max) which is the same length but easier to read.
S Apr 20, 2011 at 21:42 history suggested Community Bot CC BY-SA 3.0
reverse order of loop
Apr 20, 2011 at 13:34 review Suggested edits
S Apr 20, 2011 at 21:42
Mar 3, 2011 at 10:49 comment added Joey I usually put the ++ in such cases directly into the loop header: for(;++i<max;) which is both easier to follow and harder to get wrong.
Jan 31, 2011 at 14:15 history answered jcolebrand CC BY-SA 2.5

AltStyle によって変換されたページ (->オリジナル) /