3.10 Programming Style

xiaoxiao2021-03-06  35

About Pragins: In order to keep the comrades from C and C , it is written on the same line. But I think it is actually a good look, and it is better. About IF-ELSE-IF-ELSE: For this class, I think the following is very good.

IF (BooleaneXPR) statementelse if (BooleaneXPR) Statement Else Statement

And sometimes (for example, Eclipse's default writing format), it is written as below:

IF (BooleaneXPR) statementelse if (BooleaneXPR) StateMentelse Statement

Can you see the structure? In my opinion, this is an irresponsible way. After all, from the second IF until the end is an internal block, this block is the first ELSE statement. So I think, the code must be faithfully representing the logical structure inside the code.

转载请注明原文地址:https://www.9cbs.com/read-83180.html

New Post(0)