F# Interactive
One of the coolest things about F# is that its development environment comes with an interactive test environment: F# Interactive. You can access this feature in Visual Studio's top menu by navigating to View | Other Windows | F# Interactive or pressing the default shortcut Ctrl + Alt + F, as shown in the following screenshot:
This is valuable when we need to do the following:
- Quickly validate computations
- Spike new concepts
- Validate the implemented solution
When working with F#, you can use the interactive window to quickly validate part of a solution before implementing it. It provides a kind of a workbench when developing a test environment.
Let's say you need to implement a function that checks whether the current year is a leap year. You can enter the following code into F# Interactive in order to understand how the .NET framework manages to create a date that is not valid:
> new System.DateTime(System.DateTime.Today.Year, 2, 29);; System.ArgumentOutOfRangeException...