多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 用布尔变量对程序加以文档说明 bad ``` if( (elementIndex<0) || (MAX_ELEMENTS<elementIndex) || (elementIndex ==lastElementIndex) ){ ... } ``` good ``` finished =(elementIndex<0) || (MAX_ELEMENTS<elementIndex) ; repeatedEntry = (elementIndex ==lastElementIndex); if(finished|| repeateEntry){ ... } ``` ## 用布尔变量来简化复杂问题的判断 bad ``` If ((document.AtEndOfStream()) And (Not inputError) ) AND ((MIN_LINES <=lineCount) And (lineCount <=MAX_LINES)) And (Not ErrorProcessing()) Then 'do someting or other End If ``` good ``` allDateRead = (document.AtEndOfStream()) And (Not inputError) legalLineCount = (MIN_LINES <=lineCount) And (lineCount <=MAX_LINES) If (allDateRead ) AND (legalLineCount) And (Not ErrorProcessing()) Then 'do someting or other End If ```