Inline Temp

From CSSEMediaWiki
Revision as of 05:19, 29 July 2009 by Paul Williams (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Basically inline temp is removing variables that have been created to store a value returned from a query and replacing it with the actual query. This leads to much clearer code (arguable) and less code.

boolean payTax(int payRate) {

     int wages = payRate * hoursWorked;
     return wages >100;

}

Using inline temp

boolean payTax(int payRate) {

     return (payRate * hoursWorked) >100;

}

Personal tools