Bird
0
0

Which keyword is used to declare a custom operator function in Swift?

easy📝 Conceptual Q2 of 15
Swift - Operators and Expressions
Which keyword is used to declare a custom operator function in Swift?
Aoverload
Bfunc
Coperator
Dcustom
Step-by-Step Solution
Solution:
  1. Step 1: Recall Swift syntax for operator overloading

    Operator overloading functions are declared using the standard function keyword func.
  2. Step 2: Evaluate options

    Only func is correct; others are not valid Swift keywords for this purpose.
  3. Final Answer:

    func -> Option B
  4. Quick Check:

    Operator function declaration = func [OK]
Quick Trick: Use 'func' to define operator functions in Swift [OK]
Common Mistakes:
  • Using 'operator' keyword
  • Trying 'overload' keyword
  • Assuming 'custom' is valid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes