F# Training
F# Training
F# Training
  • Presentation
  • Fundamentals
    • Introduction
    • Syntax
      • Bases
      • Functions
      • Rules
      • Exceptions
    • First concepts
    • šŸ”Quiz
  • Functions
    • Signature
    • Concepts
    • Syntax
    • Standard functions
    • Operators
    • Addendum
    • šŸ”Quiz
    • šŸ“œSummary
  • Types
    • Overview
    • Tuples
    • Records
    • Unions
    • Enums
    • Anonymous records
    • Value types
    • šŸ“œRecap
    • Addendum
  • Monadic types
    • Intro
    • Option type
    • Result type
    • Smart constructor
    • šŸš€Computation expression (CE)
    • šŸš€CE theoretical basements
    • šŸ“œRecap
  • Pattern matching
    • Patterns
    • Match expression
    • Active patterns
    • šŸš€Fold function
    • šŸ“œRecap
    • šŸ•¹ļøExercises
  • Collections
    • Overview
    • Types
    • Common functions
    • Dedicated functions
    • šŸ”Quiz
    • šŸ“œRecap
  • Asynchronous programming
    • Asynchronous workflow
    • Interop with .NET TPL
    • šŸ“œRecap
  • Module and Namespace
    • Overview
    • Namespace
    • Module
    • šŸ”Quiz
    • šŸ“œRecap
  • Object-oriented
    • Introduction
    • Members
    • Type extensions
    • Class, Struct
    • Interface
    • Object expression
    • Recommendations
Powered by GitBook
On this page
  • Question 1
  • Question 2
  • Question 3

Was this helpful?

Edit on GitHub
  1. Module and Namespace

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

PreviousModuleNextRecap

Last updated 1 month ago

Was this helpful?

šŸ”