💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
[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 ```