Wednesday, 15 October 2014

best practices related to the if-else statement and switch statement

A few recommended best practices related to the if-else statement and switch
statement are as follows:


Always use positive logic e.g. write if (true) rather than if (! false).
Prefer switch statement rather than multiple if-else statements.
Always end a case with a break or return or throw statement unless a fall
through mechanism is intentionally used. When a fall through mechanism
is used a comment should be given like //fall through so that it is clear to
every reader.

No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...