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

Your 2020 Plan. Learn 20 minutes a day for 20 days. Online courses from €9.99.


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.



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.


Leave a Reply

Your email address will not be published. Required fields are marked *