1
Reply

what is cyclomatic complexity ?

Dharmendra Gaur

Dharmendra Gaur

14y
12.8k
0
Reply

    Cyclomatic complexity of a piece of code is the number of different paths available in the execution of the program.


    If there is no branching (if-else or switch statement) and looping (while, for & do-while loop), then the statements will execute linearly in the function. Hence cynclomatic complexity = 1;

    A Branching breaks the linear flow of execution in two parts increasing the Cyclomatic complexity of the program. Same goes for the looping statements.

    Hence the more level of indentation we have in our program the more will be the Cyclomatic complexity.