How do I find out if null was passed in? As you can guess I wasn't happy with the current behavior.

Code:

        import std.stdio;

        void main() {

                fn([1,2]);
                fn(null);
                fn([]);
        }
        void fn(int[] v) {
                writeln("-");
                if(v==null)
                        writeln("Use default");
                foreach(e; v)
                        writeln(e);
        }

Output

        -
        1
        2
        -
        Use default
        -
        Use default

Reply via email to