scitools.com

← Metric catalog

Halstead Total Operators (N1) 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 Operators (N1)

API ID: HalsteadTotalOperators
Languages: Any
Targets: Files, Functions

Halstead Total Operators (N1) counts total operators

Operators include things like + - = as well as keywords and punctuation excluding ), }, and ].

      int                   // + 1 int
      sample(               // + 1 (
      )                     //     ) excluded
      {                     // + 1 {
        int x               // + 1
          =                 // + 1 =
          strlen(           // + 1 (
            "abc"
          );                // + 1 ';'
        return x            // + 1 return
          *                 // + 1 *
          2;                // + 1 ;
      }                     //     } excluded
                            // = 10