Halstead Length (N) 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 Length (N)
| API ID | HalsteadLength |
| Targets | Files Functions |
| Languages | Any |
| Categories | Tokens |
| Cost | Slow |
| Suites | Halstead |
Halstead Length (N) is the sum of total operators (N1) and total operands (N2)
It's calculated as
- N1 = total operators (HalsteadTotalOperators)
- N2 = total operands (HalsteadTotalOperands)
- N = n1 + N2
See all Halstead metrics.