Your First Program

Hello World

Most tutorials start off with getting you to display “Hello World”, so why should this be any different?

Type in:

put "Hello World"

Now compile and run it. The output is:

Hello World 

That was easy and we have got that one out of the way, but let us try something different. Change your code to:

put 'Hello World'

and compile and run it. You will see no difference in the output. Both single and double quote characters may be used to enclose strings.

You may also include the other quote character as part of your text without any problem.

Let us now get a little more complicated. Suppose that you wanted to display:

John's computer isn't showing "Hello World".

Enter and run:

put 'John''s computer isn''t showing "Hello World".'
put "John's computer isn't showing ""Hello World""."

As you can see both lines give the same result. Where the enclosing quote character is doubled it does not end the string but instead acts as an escape character for itself.

Finally try this:

put hello world

Just remember this for now. It will be explained later.

Of course, if you were brought up in the world of escape characters and long for them, you can have them, but more of that later.

lynplexs/tutorial/c04.txt · Last modified: 2014/05/26 07:59 (external edit)