Re: Why does Nullable implicitly casts when assigning a variable but not when returning from a function?

2024-04-10 Thread Lettever via Digitalmars-d-learn
On Wednesday, 10 April 2024 at 21:38:22 UTC, Andy Valencia wrote: On Wednesday, 10 April 2024 at 20:41:56 UTC, Lettever wrote: ``` import std; Nullable!int func() => 3; void main() { Nullable!int a = 3; //works fine Nullable!int b = func(); //does not compile } Why make func()

Testing membership in associative array

2024-03-04 Thread Lettever via Digitalmars-d-learn
I am trying to create a function that tests membership in nested associative array, however the function I create below, only accepts keys of the same type and if given keys of different types it does not compile, help would be appreciated. This is a example of what Im talking about. ```d impor