Halstead Total Operands (N2) is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Halstead Total Operands (N2)
API ID: HalsteadTotalOperandsLanguages: Any
Targets: Files, Functions
Halstead Total Operands (N2) counts total operands (identifiers and literals)
int
sample( // + 1 sample
)
{
int x // + 1 x
=
strlen( // + 1 strlen
"abc" // + 1 "abc"
);
return x // + 1 x
*
2; // + 1 2
} // = 6