Allow different return types for 1 function
#2

Quote:
Originally Posted by Redirect Left
Посмотреть сообщение
Hello.

How can I allow a function to return two different types? IE if you specify returntype=1, it gives you a string return, if returntype=2 it will return a number instead. I'm trying to do multiple stuff in one function so I don't have to create two or three different ones.

Unfortunately, I currently get the error "error 079: inconsistent return types"
You could just return a string, but then use isnumeric to check if it's a numerical return.
Reply


Messages In This Thread
Allow different return types for 1 function - by Redirect Left - 29.07.2014, 18:28
Re: Allow different return types for 1 function - by Kyle - 29.07.2014, 18:36
Re: Allow different return types for 1 function - by Redirect Left - 29.07.2014, 18:39
Re: Allow different return types for 1 function - by Kyle - 29.07.2014, 18:45
Re: Allow different return types for 1 function - by Redirect Left - 29.07.2014, 18:47
Re: Allow different return types for 1 function - by Kyle - 29.07.2014, 18:52

Forum Jump:


Users browsing this thread: 2 Guest(s)