23.03.2012, 23:23
Hey, a simple question this time, I've never used this method while coding before so I'm not sure how to workaround this:
Say you have a function that returns 0 if it fails:
So I did the same thing with a string:
This crashes the compiler and so does this:
I never knew you couldn't return strings like return "this";
So now I'm at a loss and don't know what to return at the end, I can't return nothing because I get a 'must return something' error.
Say you have a function that returns 0 if it fails:
Code:
func(something) { if(something == somethingelse) return 5; return 0; }
Code:
func(something) { if(something == somethingelse) return somestring; return ""; }
Code:
func(something) { if(something == somethingelse) return somestring; return "<NULL>"; }
So now I'm at a loss and don't know what to return at the end, I can't return nothing because I get a 'must return something' error.