Return a string not Working in Unity

Hey, I just tested something and got over this one.

void Start () 
{
  returnString();
}

public string returnString()
{
   return "This is a string";
}

So actually this is not working ))), it will not put in the console a message with
“This is a string”.

is this true that not working like this way. I mean, you can print mess. only Of Debug and print. Or I have to import some library ?

Hello,

You’re returning the string but not doing anything with it.
use it like this:

void Start(){
    Debug.Log( returnString() );
}

String by itself would not go to the console, You have to “point” objects to the console like in the example above.

Regards,
M.Rogalski

If you want to return a string just declare a string variable and if you want to see the string in the console use either Debug.Log either print(“bla bla string”);