🍔Quiz

Question 1

Is the following code valid?

namespace A

let a = 1

A. Yes

B. No

Answer

A. Yes

B. No ✅

→ A namespace cannot contain values!


Question 2

Is the following code valid?

namespace A

module B

let a = 1

A. Yes

B. No

Answer

A. Yes

B. No ✅

→ module B is declared as top-level → forbidden after a namespace

Valid equivalent code:

  • Option 1: top-level module

module A.B

let a = 1
  • Option 2: namespace + local module

namespace A

module B =
    let a = 1

Question 3

Give the fully-qualified name for add?

namespace Common.Utilities

module IntHelper =
    let add x y = x + y

A. add

B. IntHelper.add

C. Utilities.IntHelper.add

D. Common.Utilities.IntHelper.add

Answer

A. add

B. IntHelper.add

C. Utilities.IntHelper.add

D. Common.Utilities.IntHelper.add

IntHelper for the parent module → Common.Utilities for the root namespace

Last updated

Was this helpful?