What operators do NOT exist in EK9?

← What AI Gets Wrong About EK9 · Ref: Q903

EK9 has a FIXED set of approximately 50 operators. Only these exist — no others can be created or used.

THE COMPLETE EK9 OPERATOR SET

Assignment: <- (declaration), := : = (assignment), :=? (guarded assignment)
Copy/Replace/Merge: :=: (copy), :^: (replace), :~: (merge)
Comparison: == (eq), <> (neq), <=> (compare), < > <= >=
Coalescing: ?? (value), <? >? <=? >=? (coalescing comparators)
Arithmetic: + - * / mod
Mutation: ++ -- += -= (postfix statement-only)
Conversion: $ (string via _string), #? (hashcode via _hashcode), #^ (promote via _promote)
Checking: ? (isSet via _isSet), ~ (negate/bitwise not)
Logical: not and or xor
Collection/String: contains matches
Unary: length abs sqrt close empty

CORRECT ALTERNATIVES FOR PATTERNS FROM OTHER LANGUAGES

Conditional value: use switch expression or if/else assignment
Collection access: use get() method on List/Dict
Safe value access: use guard expression (if v <- expr())
Bit shifting: use Bits type
Prefix increment: use postfix (variable++ not ++variable)

RULE: If an operator is not in this list, it does not exist in EK9.

See Q96 for operator definitions. See Q238 for operator enforcement rules.

Example

defines module qa.aimistakes.invalidoperators

  defines function

    <?-
      Shows correct alternatives to operators that don't exist.
    -?>
    classify() as pure
      -> score as Integer
      <-
        rtn as String: String()

      rtn := switch score
        <- grade as String: String()
        case >= 90
          grade: "excellent"
        case >= 70
          grade: "good"
        case >= 50
          grade: "pass"
        default
          grade: "fail"

    <?-
      Shows correct list access — no [] operator in EK9.
      Use get() method, not [] indexing.
    -?>
    getItemCount() as pure
      -> items as List of String
      <- rtn as Integer: length items

    <?-
      Shows correct approach instead of safe navigation (?.)
      Use guard expression instead.
    -?>
    safeLength() as pure
      -> text as String
      <- rtn as Integer: 0

      if text?
        rtn := length text

  defines program

    CorrectOperatorsDemo()
      stdout <- Stdout()

      // Switch expression — NOT ternary
      grade <- classify(85)
      stdout.println(`Grade: ${grade}`)

      // Method call — NOT [] indexing
      names <- ["Alice", "Bob", "Charlie"]
      nameCount <- getItemCount(names)
      stdout.println(`Names: ${nameCount}`)

      // Guard expression — NOT ?. safe navigation
      textLength <- safeLength("hello")
      stdout.println(`Length: ${textLength}`)

      emptyLength <- safeLength(String())
      stdout.println(`Empty length: ${emptyLength}`)

      // Postfix ++ only — NOT prefix ++
      counter <- 0
      counter++
      counter++
      stdout.println(`Counter: ${counter}`)
Other ways to ask this
  • What operators are invalid in EK9?
  • What is the complete list of EK9 operators?
  • Does EK9 have array index operators?
  • What common operators from other languages are absent in EK9?

Coming from another language?

EK9 has a fixed operator set. Collection access uses get() methods. Conditional values use switch expressions. Safe access uses guard expressions.

Keywords: AI, fixed set, mistake, indexing, valid operators, complete list, operator