DotNetKick.com is an open-source project. Please report any bugs and let us know your great suggestions. Currently running svn revision 637 (rss)

Kick Spy!, Kick Zeitgeist and Kick Widgets

1
kicks
submitted by jsebast 3 months, 2 days ago

jordansebastian.com — The second installment of my guide to basic code elegance.

tags: | tag it

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:

Comments:
You could improve this further by replacing your second version:

int something(int goofy, int mickey)
{
bool isBigger = (goofy > mickey);
if(isBigger)
return goofy;
return mickey;
}

with this:

int something(int goofy, int mickey)
{
if(goofy > mickey)
return goofy;
return mickey;
}

As there is no point caching the result of the goofy > mikey test if you are not going to use that result again within the method.

You could go one step further and use the ternary operator and write the method like this:

int something(int goofy, int mickey)
{
return (goofy > mickey) ? goofy : mickey;
}
posted by Tr3v 3 months, 1 day ago



information Login or create an account to comment on this story
 

Sponsored Link: www.carlist.ie

Search:

Ads by The Lounge