Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# how to write an empty statement

Tags:

How can I write a no-op statement in F#?

Specifically, how can I improve the second clause of the following match statement:

match list with     | [] -> printfn "Empty!"     | _ -> ignore 0 
like image 498
Eamon Nerbonne Avatar asked Apr 24 '10 11:04

Eamon Nerbonne


People also ask

Facebook itu apa sih?

Facebook adalah media sosial dan layanan jejaring sosial online Amerika yang dimiliki oleh Meta Platforms.


1 Answers

Use unit for empty side effect:

match list with   | [] -> printfn "Empty!"   | _ -> () 
like image 81
Stringer Avatar answered Nov 07 '22 02:11

Stringer