Command syntax
The first rule is, that any input must begin with the name of the command. Let's simply print a message to the console.
Initially, we would type: print
. Following this, we need to specify the message we wish to display. As the command anticipates a string
argument, we could input: print Hello
.
For a simple message, this would be sufficient. However, since arguments are separated by an empty space, the command would become invalid if we were to type: print Hello World
.
This is because we have technically supplied the print command with two distinct arguments when it only accepts one. In such instances, we simply enclose our argument in quotation marks: print "Hello World"
.
Note
It is also possible to use '
to enclose strings.
Last updated