[haXe] conditionnal if else

filt3r at free.fr filt3r at free.fr
Tue Apr 10 18:31:34 CEST 2007


Re :)
I've another mistake for today :D, when I write :

var b : Button = if ( _bMultiSelect ) new CheckButton () else new RadioButton
();

compiler gives me : "RadioButton should be CheckButton"
And when I write :

var b : FButton;
if ( _bMultiSelect )
	b = new CheckButton ()
else
	b = new FRadioButton ();

All works correctly.
If in the 1st case I wouldn't write "var b : Button = ..." but "var b = ...", I
wouldn't be surprised because of inference, but here I don't understand.
Is it an mistake or I'm wrong ? (I know it's not really important but I would
know)
N:B: CheckButton and RadioButton extends both "Button"
Thanks,
Michel



More information about the Haxe mailing list