contents   index   previous   next



Literal strings and returns

 

When a literal string is returned from a function by a return statement, it is returned as a copy of the string. The following code:

 

for (var i = 0; i < 3; i++)

{

   var str = Clib.strcat(dog(),"house");

   Clib.puts(str)

}

 

function dog()

{

   return "dog";

}

 

results in the following output:

 

doghouse

doghouse

doghouse

 


Literal Strings and switch statements