Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# function parameters

Tags:

f#

I have 2 lines of code here:

let stuff _ _ = MessageBox.Show("This is doing stuff") |> ignore
let stuffHandler = new EventHandler(stuff)

I just started with F# and would like to know why the code does not compile if I remove underscores from stuff variable? As far as I know underscore means to ignore something so what should be ignored here?

like image 976
Micha Avatar asked May 22 '26 03:05

Micha


1 Answers

The EventHandler delegate expects a function with 2 parameters, the sender and the EventArgs.

like image 170
Phillip Trelford Avatar answered May 25 '26 16:05

Phillip Trelford



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!