Вот простой пример.
Код: Выделить всё
//declare variables for if statement only
int price = getProductionCost() + getTax() + getPurchaseMethod() + etc + etc;
int shipping = getLocation() + getShippingType() + etc;
if (price + shipping > 1000)
{
// Is this better practice using variables?
}
// if price + shipping > 1000
if (getProductionCost() + getTax() + getPurchaseMethod() + etc + etc + getLocation() + getShippingType() + etc > 1000)
{
// or is this option better practice with commenting and no variables?
}
Подробнее здесь: https://stackoverflow.com/questions/325 ... ractices-c
Мобильная версия