Document

First-time Coding

No matter what path you take, the first step is important. In this guide, we'll show you how to say "Hello, World!" in YPSH.

1. Check the YPSH version

This guide is based on YPSH v8.0. If the YPSH version in your environment is too old, please update it.

2. Create a YPSH script

Let's create a YPSH script. Create a hello-world.ypsh file and open it in your favorite editor.

3. Write the code

Write the following code and save it. (there will be an explanation later)

print("Hello, World!")

4. Run it!

Run it using the ypsh command.

ypsh /path/to/hello-world.ypsh

The execution result should look like this:

Hello, World!

5. Why am I getting this result?

Let’s recall the code from earlier. First, let’s explain what print is. print is a function used to output any content to the console (more precisely, to stdout). Now, let’s break down the expression print("Hello, World!").

  1. print: A function that performs output.
  2. ( and ): Mean “run this function using the value(s) inside.”
  3. Argument: A value passed to a function. In this case, you are passing a single argument: "Hello, World!".
  4. " (double quotation marks): Indicate that the value is a string. "Hello, World!" is treated not as code, but simply as a sequence of characters (a string).

Trying without the double quotation marks

Let’s try rewriting it as follows:

print(Hello, World!)

Then, you should get an error like this:

<YPSH:E0003> SyntaxError: Expected token RPAREN but got Token(NOT, !, line=2).

Why does this cause an error?

The program tries to interpret Hello and World as variable names or function names. However, since no such variables or functions are defined, the error occurs during parsing (syntax analysis). On top of that, the comma and ! have no meaning in this context as code, so they are deemed syntactically invalid.

Key points:

  • Strings must always be enclosed in " or '
  • Without them, the program will try to interpret the text as “names” or “syntax” rather than as literal strings