Tour Try F#

Take a guided tour of Try F# with this video

Using the Editor

The TryFSharp editor enables you to write and execute F# code when following the tutorials in Learn, and building projects in Create. It operates similarly to the F# Interactive Window in Visual Studio.

Editor Windows

  • Script window: The main window where you paste code to run, and write your own code. Right-click to bring up a context menu with options to cut, copy, paste and select all. There may be additional options depending on which browser you are using. The script window features Intellisense, which displays pertinent language information as you type. The Intellisense completion popup will remain visible until it is clicked, or Tab is pressed.
  • Output window: Located below the script window, the output window displays the textual results of your code. While coding, the output window displays detailed information based on the current Intellisense feedback.
  • Canvas: The canvas displays programmatically generated graphic elements, such as charts and graphs. You can toggle the display of the canvas by clicking hide canvas and show canvas respectively. The canvas is automatically displayed each time you run a code example that uses the charting library. In some cases, depending on such factors as screen resolution or the size of the browser window, axis labels may not display correctly. If this happens, you can resize the canvas to make it larger and re-run the sample to redraw the chart. Another option is to modify the code by using WithXAxis and WithYAxis. With these options you can customize the axes to include a minimum and maximum value, which has the effect of controlling the density of the axis labels. To learn more, see Charting Quick-Start.

Editor Controls

  • Full screen/Collapse: Collapse the left pane to make more room for the script window, output window, and canvas.
  • Show/Hide canvas: Toggle display of the canvas.
  • Run: Runs the selected code, or the entire script if nothing is selected.
  • Resize: Click and drag the double-arrow icons to adjust window sizes.
  • Save (Create Interface only): Save the contents of the script Window to your local computer using the .fsx file extension.
  • Prev/Next (output window): Navigate member signature information in the output window. These appear when there is more than one page, for example if there is an overloaded member.
  • Pushpin (output window): Pin the contents of the output window to keep it open for extended reference.
  • More: Choose from the following additional options:
    • Reset session: Reset the current session; removes all in-memory items such as variables, and reinitializes the engine.
    • Cancel evaluation: Cancel the current operation. Use this if the code is taking too much time to execute.
    • Clear canvas Clear the contents of the canvas window.
    • Clear script window: Clear the contents of the script window.
    • Clear output window: Clear the contents of the output window.

Learn Interface

At the bottom of each code example there is either a load button or a load and run button. The load button loads the example code into the script window, but does not run the code, while load and run both loads and runs the code as the name implies. Important: In all cases load and load and run will overwrite whatever code is currently present in the script window.

In cases where a code example has external dependencies, the code and references are loaded automatically with the example code. This feature is intended to allow each individual example to run independently. In most cases the additional code will prepend the code example.

Within each lesson there are the following navigational elements:

  • The prev lesson and next lesson buttons take you to the previous and next lesson respectively. These are located at the bottom of the content window (far left).
  • The back button (arrow icon) takes you back to the beginning of the current section, or to the top level of Learn. This button is located at the top of the content window, to the left of the main heading.

Create Interface

In the Create section you can manage files in the window on the left side. Files are displayed in a flat list, and can be sorted alphabetically by filename, or by date.

  • Create button - Create a new file from scratch.
  • Upload button - Upload a file from your local computer
  • Refresh button - Refresh the file list.
  • Filter textbox - Type a filename or part of a filename to filter the file list.
  • Sort buttons - Sort by filename or date.
  • Click the action button next to a file to bring up the available options: open, download, rename, delete and share.

Keyboard Shortcuts

  • To run all code: Click the Run button or use Ctrl+Enter to run all code that is currently in the script window.
  • To run a line of code: Position the cursor on the line you want to run and use Ctrl+Shift+Enter to send the code to F# Interactive. You can "step" through successive lines of code this way, since the enter key moves the selection to the next line.
  • To reset the session and clear the output window: Refresh the browser or use Ctrl+Shift+R.

Shortcuts reference

The following table lists all of the supported keyboard shortcuts for the TryFSharp editor.


Command Shortcut
Find Ctrl-F, Ctrl-F3
Find Next F3
Find Previous Shift-F3
Toggle Fullscreen Mode Ctrl-F11
Insert Line Comment Ctrl-/, Ctrl-7
Insert Block Comment Shift-Alt-A
Delete Line Ctrl-D
Move Line Down Alt-DownArrow
Move Line Up Alt-UpArrow
Copy Line Down Shift-Alt-DownArrow
Copy Line Up Shift-Alt-UpArrow
Expand Select Ctrl-Shift-RightArrow
Shrink Select Ctrl-Shift-LeftArrow
Go To Next Marker Ctrl-,
Go To Previous Marker Ctrl-Shift-,
Go to Symbol Ctrl-Alt-O, Ctrl-Shift-O
Trigger Suggest Ctrl-Space