Empty functions

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Oct 29 13:39:19 UTC 2020


On Thu, Oct 29, 2020 at 09:06:21AM +0000, Jan Hönig via Digitalmars-d-learn wrote:
> On Thursday, 29 October 2020 at 09:01:12 UTC, Jan Hönig wrote:
> > This would mean, that this one should work as well.
> 
> It does not work as I intended, as `() => {}` has not the return type
> of `void`.
> 
> (I don't know how to print: `ReturnType!(() => {})`)

What you want is `() {}`, which is equivalent to `void function() {}`.

`() => {}` means something different; it's equivalent to:

	() { return () {}; }

i.e., it's a function that returns an empty function.


T

-- 
Tell me and I forget. Teach me and I remember. Involve me and I understand. -- Benjamin Franklin


More information about the Digitalmars-d-learn mailing list