Concatenation is the operation of joining two things together. For example, the strings "foo" and "bar" may be concatenated to give "foobar". Arrays can also be concatenated by using addarray.

String Concatenation
In GScript, there are only four string concatenation operators. These operators are @, SPC, TAB, and NL.


this.value = "foo" @ "bar";
// producing "foobar"

this.value = "foo" SPC "bar";
// producing "foo bar"

this.value = "foo" TAB "bar";
// producing "foo         bar"

this.value = "foo" NL "bar";
// producing "foo

Applied example:
function onCreated() {
  this.suggestedattire = "scarf, gloves, parka, and hat.";
  this.welcomemessage = "It is snowing, so you may want to wear your" SPC this.suggestedattire;
  this.goodbyemessage = "Come again tomorrow for more weather information!";
  echo("Hello, " @ player.account @ ". " @ this.welcomemessage NL this.goodbyemessage);



There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki