How to convert defaults so a number defaulted to NaN?

(Chrisvelevitch) #1

I’m new to Haxe and I’m trying to convert this as3 function to Haxe. What is the Haxe equivalent of:-

function test(value:Number = NaN):void

I tried:-

function test(value:Float = Math.NaN)

but I get:-

Parameter default value should be constant

and I tried:-

function test(value:Float = NaN)

and I get:-

Unknown identifer : NaN

(Seb) #2

How about something like:

function test(value:Null<Float> = null) {
   If (value == null)
      value = Math.NaN;