On Wednesday, 30 June 2021 at 03:15:46 UTC, someone wrote:
Is the following code block valid ?

```d
float price; /// initialized as float.nan by default ... right ?

if (price == float.nan) {

   /// writeln("initialized");

} else {

   /// writeln("uninitialized");

}
```

if so, the following one should be valid too ... right ?

```d
float price;

if (price != float.nan) {

   /// writeln("initialized");

}
```

Side note: in case you want to work with money, you may consider using a specific data type like https://code.dlang.org/packages/money instead of float/double.

Kind regards
Andre

Reply via email to