Q&A
Ask and answer questions to make information more available to wider audiences.
Devin Truttman @truttmandevin   22, May 2023 12:00 AM
unit type
What is the unit type in F#?
answers 2
 
Answer 1
Payton Leonard @leonardpayton   31, May 2023 12:16 PM
Here is an example:

let function1 x y = x + y                 
  
function1 10 20      // this line results a compiler warning  
      
// changing the code to the following and eliminates the warning  
let result = function1 10 20  
  
// Use this if you are calling the function and don't want the return value  
function1 10 20 |> ignore  

 
Answer 2
London Leon @leonlondon852   31, May 2023 12:02 PM
The unit type is a type which indicates the absence of specific value. The unit type has only a single value. This value acts as a placeholder when no other value exist.