In C#, I do this:
public const double PAPER_SIZE_WIDTH = 8.5 * 96;
What is the best way to define this global constant in F#?
This fails:
[<Literal>]
let PaperSizeWidth = 8.5*96.0
Error: This is not a valid constant expression
TIA
In C#, I do this:
public const double PAPER_SIZE_WIDTH = 8.5 * 96;
What is the best way to define this global constant in F#?
This fails:
[<Literal>]
let PaperSizeWidth = 8.5*96.0
Error: This is not a valid constant expression
TIA
Arithmetic is not yet supported for numeric literals in F#. Instead, you have to provide the final value explicitly:
[<Literal>]
let PaperSizeWidth = 816.0
However, every value is immutable by default in F#, so this might be good enough, depending on your needs:
let PaperSizeWidth = 8.5 * 96.0