Home.NETF# Recipe #2 – The type int is not compatible with type unit

F# Recipe #2 – The type int is not compatible with type unit

Problem

When writing your first F# program , you get the following error “The type int is not compatible with type unit”. You need to fix this.

image

Solution

The type unit is F#’s version of void. This indicates that the compiler was expected an return value of int but there is no return value.

This can be fixed by adding 0 to the end to return 0 as shown in the screenshot below.

image

Share:

Leave a Reply

You May Also Like

In this post, you’ll learn about the error message “WorkbookNotSupported – The file you selected cannot be opened because it...
  • .NET
  • December 17, 2022
In this post, you’ll learn about the error message “SpecifiedRangeNotFound – The requested range does not exist in the sheet.”...
  • .NET
  • December 17, 2022
In this post, you’ll learn about the error message “SheetRangeMismatch – The sheet provided as the sheet argument is not...
  • .NET
  • December 17, 2022