User Tools

Site Tools


tutorial:helloworld

Hello World

The first code a programmer usually writes in a new language is the Hello World program. It simply displays “Hello World” on the screen, which is a good indication that everything works and the developer has a basic understanding of the tools at hand.

First, open a new Editor window in SyMAT. From the Run menu, choose the language you want to write in.

JavaScript/Java

We are using the print function to display text, which we place in quotes to separate it from other code.

print("Hello World!");

The semicolon (;) at the end of the code tells SyMAT where the end of the command is. To save space, sometimes you might want to put multiple commands on one line. That's why the semicolon is needed.

Run the code. You should see Hello World! in the Output window.

JavaScript and Java have a lot of formatting in common, so this bit of code happens to work the same on both.

Python

For Python, the code is almost the same. Simply remove the semicolon from the end of the line. Python uses the invisible newline character (what you get when you press Enter or Return) instead of a semicolon. This means you cannot have multiple Python commands on a single line.

Going further

Here are some other things you can try:

  • Try replacing Hello World with other text.
  • See what happens if you put \n or \t into the middle of your text.
  • Put another print command below the one you have now. What happens when you run it now?
tutorial/helloworld.txt · Last modified: 2018/05/12 00:52 (external edit)