> Tutorial
Strings (character strings) are a type of value used to represent text.
A string is written between single or double quotes:
var a = "hi"var b = 'hello world'Only one operator is available on strings: +, the concatenation operator, which "glues" two strings together:
Many functions are available for strings, in the "Strings" section of the documentation. The main ones are:
Examples:
Several standard functions use strings, such as getName, which returns the name of an entity. We are going to use it to greet our opponent on turn 1:
The say function makes your leek say something; it costs 1 TP . As you may have guessed, against an enemy named Domingo, our leek will say: "Hi Domingo!". Feel free to customize it, as long as you stay polite!
What is the result of the code "10" + 5 + "aa"?
"105aa" "15aa" "10aaaaaaaa" "15aaaaa"
What is the result of the code substring("eucalyptus", 4, 3)?
"lyp" "euc" "ptus" "euca"
Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.