Return a String

BlitzPlus Forums/BlitzPlus Beginners Area/Return a String

Hardrive(Posted 2007) [#1]
How do you return a string from a fuction? Currently, I can only figure out how to return an integer; when I try to return a string, it just returns 0.

I can't even return this:
Return "This is a string"

Is this a limitation to Blitz? Do I have to just declare a Public variable outside of the function and then modify that?


rdodson41(Posted 2007) [#2]
Function getstring$()
    Return "This is a string"
EndFunction

Function names are followed by the type they return:
% or blank for integers
# for floats
$ for strings
.TypeName for user defined types

getint() or getint%()
getfloat#()
getstring$()
getalien.talien()


Hardrive(Posted 2007) [#3]
Wow thanks for the quick respose!


Réno(Posted 2007) [#4]
Thanks too. I didn't know that, because I always return integer variables.