討論串[閒聊] 尋求比nest-if更優美的解決辦法
共 21 篇文章
內容預覽:
如果是 C++ 的話 ... 我通常是用 exception 說. if( data == NULL ) {. // error return. }. try {. checkData( data );. modifyData( data );. fireDataChanged( data );.
(還有244個字)
內容預覽:
當然善用shortcut-circuit evaluation寫邏輯句子很容易:. (data == NULL) && printf("Data not found."). || (checkData(data) != 0) && printf("Data is invaild."). || (mo
(還有299個字)
內容預覽:
兩三年前會用這個怪格式寫 XD. (data == NULL) ? printf("Data not found."):. (checkData(data) != 0) ? printf("Data is invaild."):. (modifyData(data) != 0) ? printf("
(還有154個字)
內容預覽:
下文43.. 其實如果你的問題只是 應該如何撰寫or排列這些condition.. 語意不變的對應寫法 就是 "衛句". if( NULL==data ){. print("data not found");. return;. }. if( checkData(data) == 0 ){. pri
(還有231個字)