BeginnersTutorial:Tutorial/Lesson 2

From jWork.ORG
Jump to: navigation, search

Lesson 2: Working with text

A variable can not only keep numbers, but it can also stand for also other complicated "objects", such as text, images, and large collections of numbers.

Let us show that we can keep a text:

text="This is my first text"

Now the variable "text" keeps your sentence. In fact, this variable can keep an entire novel! How you can check that the variable contains something? As usual, print it:

text="This is my first text"
print text

You can add pieces of text together to make a longer text:

t1="This is my text."
t2="This is another text."
text=t1+t2
print text

This will print the sentence:

This is my text. This is another text.