Introduction to F#

Duration

5 minutes

Lab Goals

The primary goal of this lab will be to interact with the REPL (Read-Evaluate-Print-Loop) and experiement with assigning values and printing strings.

Tip: If you are doing this exercise live in a session, make sure to make good use of the instructor, they are online to answer any questions you have!

Steps

Setup

  1. Open Visual Studio.
  2. Open the REPL window in your IDE
    • Visual Studio for Mac - View > Pads > F# Interactive
    • Visual Studio on Windows - View > F# Interactive

Assigning Values

  1. Enter the following into your REPL (remember to use a double-semicolon to terminate the REPL input in the window). What happens? You can check out all the format specifiers for printfn on MSDN.
    printfn "hello world";;
  2. Next, enter the following statement into your REPL. What happens?
    let x = 42;;
  3. Try to change value you just assigned. Does it work? Was that value immutable?
    let x = 10;;

Summary

In this lab, we have opened the REPL and begun to interact with it.

Go Back