This page has no translation to 日本語 yet. The original English version is below. If you’d like to help, great! See how to translate a documentation page in the contribution guide.
Note This is a web-version of a tutorial chapter embedded right into the XOD IDE. To get a better learning experience we recommend to install the desktop IDE or start the browser-based IDE, and you’ll see the same tutorial there.


Screenshot of 012-strings

Another important data type is a string. Strings represent pieces of text like “Hello World!” or “”. XOD depicts the string type in yellow.

Tweak nodes for strings are a bit special. For optimisation purposes XOD needs to know the maximum length of the tweaked string, so there are several ones available. When you want to add a string tweak, choose the smallest one necessary.

The standard library contains a few nodes to work with strings and text. One useful node is concat. It joins several parts into a single one. This allows creating a message out of several data sources.

Exercise #

Try strings in runtime.

  1. Run the Simulation.
  2. Observe how the message alternates between “Hello World” and “Hello XOD”.
  3. Change values of tweak-string-16s to change the message.
  4. Add a third pin to concat and bind an exclamation point to it.

👆 Generics #

Note, the if-else node can work with numbers or strings depending on the incoming value type. The pins which accept various types are called generic. You can spot them by the little dot in the center.

If you want to bind a string value to a generic pin, you should enquote it because the number 3.14 and the string "3.14" are different things. The quotes explicitly tell XOD you’ve meant a string value.

Found a typo or mistake? Want to improve the text? Edit this page on GitHub and open a pull request. If you have a complex proposal or you want to discuss the content, feel free to start a new thread on XOD forum.