scitools.com

← Metric catalog

Halstead Distinct 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 Distinct Operators (n1)

API IDHalsteadDistinctOperators
TargetsFiles Functions
LanguagesAny
CategoriesTokens
CostSlow
SuitesHalstead

Halstead Distinct Operators (n1) counts unique operators

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

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

See all Halstead metrics.