Hello world/Newbie
Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task.
- Assume the language-newbie is a programmer in another language.
- Assume the language-newbie is competent in installing software for the platform.
- Assume the language-newbie can use one simple text editor for the OS/platform, (but that may not necessarily be a particular one if the installation needs a particular editor).
- Refer to, (and link to), already existing documentation as much as possible (but provide a summary here).
- Remember to state where to view the output.
- If particular IDE's or editors are required that are not standard, then point to/explain their installation too.
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
- Task
- Note:
- If it is more natural for a language to give output via a GUI or to a file etc, then use that method of output rather than as text to a terminal/command-line, but remember to give instructions on how to view the output generated.
- You may use sub-headings if giving instructions for multiple platforms.
ALGOL 68
For information on installing and using algol68g, read Learning ALGOL 68 Genie by Marcel van der Veer.
While algol68g is available for Mac OS X, this example currently does not provide instructions on running the "Hello, World" program on OS X.
1. Download algol68g.
2. Install algol68g on Linux, or unzip it to a convenient location on Windows.
3. Use your favorite text editor.
3. Open the text editor and type the following: <lang algol68>main: (
printf($"Goodbye, World!"l$)
)</lang>
4. Save the file with the extension .a68.
5. Open a command prompt/terminal. Execute "a68g path/to/file/filename.a68" on Linux, or "path/to/a68g/a68g.exe path/to/file/filename.a68" on Windows.
Replace the paths above with their corresponding paths on your system.
The output will appear in the command prompt/terminal.
AutoHotkey
The Tutorial and Overview, which is part of the AutoHotkey Documentation, covers the basics of AutoHotkey. The documentation is available online and is included as a .chm help file with installation. Installation and "Hello World" are summarized here.
1) Download and install AutoHotkey.
2) Download and install the SciTE4AutoHotkey editor (recommended), or use your favorite texteditor.
3) Open the text editor and type the following: <lang AutoHotkey>MsgBox, Hello World!</lang>
4) Save the file with the extension .ahk.
5) Double-click the file to launch it. A message box appears displaying "Hello World!" and an icon appears in the taskbar notification area.
6) To exit or edit the script, right-click the green "H" icon in the taskbar notification area. Closing the message box will also exit this particular script.
AWK
AWK on Linux
AWK is a standard tool in Unix / most Linux-distributions.
So, it should be already installed.
To run awk, either provide code on shell (using single quotes).
$ awk 'BEGIN{print "Goodbye, World!"}'
Or put code to file and load it from file.
$ awk -f hello-world.awk
AWK on Windows
Select one of the awk-implementations to download.
E.g. gnuwin32.sourceforge.net provides gawk, mawk and nawk.
The most current gawk is at gnu.org, but only as source.
To get a ready-made executable, look at code.google.com - gawk v4.1.0 currently.
Download, extract the executable file and "install" it.
In most cases, installation can be done by just moving that exe-file to a convincent place, e.g. a directory that is already in the PATH.
Otherwise, the PATH can be changed in the Windows-Systemsettings, under environment-variables.
Alternatively, keep the awk-program in the same directory as the scripts you are going to write / run.
Try to run it, from a commandline:
awk -V
or
mawk -W version
or
gawk --version
to display its version-number.
To do a simple calculation, try a one-liner like this:
awk "BEGIN{ print 17/4 }"
Note the use of double-quotes, and curly-braces.
Using the windows-commandline, single-quotes cannot be used.
That means one-liners using strings need awkward quoting:
awk "BEGIN{print \"Hello\"}"
As a workaround, you can assign variables just before the script:
awk -v x="Hello" "BEGIN{print x}"
So in most cases, running scripts from files is easier.
awk -f hello.awk
Where hello.awk contains <lang awk>BEGIN {
print "Hello" 3-1 "U", sprintf("%c",33)
} </lang>
- Output:
Hello2U !
To edit awk-scripts use a texteditor.
Now, look at some example-programs from category AWK, for example: Read a file line by line
Axe
Besides the built-in program editor on the TI-83/84, Axe requires a compiler app to be installed on the calculator. This is for development only, and is not required on user's calculators.
To install Axe, download the latest version and transfer it to the calculator.
Next, follow the instructions below in the TI-83 BASIC section to create a sample program named MYPROGRM. The contents of the program should be:
<lang axe>PROGRAM:MYPROGRM
- .HELLO
- Disp "HELLO, WORLD!",i</lang>
Note that the first line contains the name of the program to be compiled. Also note that the i is the imaginary symbol, not the lowercase letter.
Then quit the program editor and press APPS. Go to the newly installed Axe app and select Options. Use the arrow keys to select the correct shell for your setup, then press Clear to go back.
Go to Compile, select MYPROGRM, and press Enter. Your program should compile without errors and will be saved in prgmHELLO. You can run this program from whichever shell you selected in the options (or from the home screen if you selected "no shell"). Run it as you would an assembly program.
BASIC256
Installation
Download BASIC256 here: http://sourceforge.net/projects/kidbasic/
Interface
BASIC256 is an Integrated Development Environment (IDE). The code editor, the text output section, and the graphics output section are displayed at the same time.
HelloWorld Program (Text Output)
To display the "HelloWorld!" in the Text Output, copy this code and paste to the code editor:
<lang basic256>Print "HelloWorld!"</lang>
Then press F5 or click the play button.
HelloWorld Program (Graphics Output)
To display the "HelloWorld!" in the Graphics Output, copy this code and paste to the code editor:
<lang basic256>clg # Clear the graphics screen
font "Arial",10,100 # Set the font style, size, and weight respectively
color black # Set the color...
text 0,0,"HelloWorld!" # Display in (x,y) the text HelloWorld!</lang>
Then press F5 or click the play button.
Documentation
Press F1 or click the Help menu for language help/documentations.
Befunge
Befunge is a two-dimensional fungeoidal (in fact, the original fungeoid) esoteric programming language invented in 1993 by Chris Pressey with the goal of being as difficult to compile as possible. A Befunge program consists of a two-dimensional playfield of fixed size. The playfield is initially loaded with the instructions of the program. It also doubles as an updateable storage unit. Execution proceeds by the means of a program counter (-93) or instruction pointer (-98). The instruction pointer begins at a set location (the upper-left corner of the playfield) and is initially travelling in a set direction (right). As it encounters instructions, they are executed. The instructions may have an effect on the instruction pointer's direction and position (-98 only). Instructions may also affect the contents of a stack. See Befunge on Esolang for more information and examples.
To start, you will need a Befunge interpreter. You can find one online, or download one.
What the end product will look like: <lang Befunge>"!dlrow olleH">:#,_@</lang>
Explanation
"!dlrow olleH"
You might be wondering why the text is backwards. The quotation marks (") toggle 'stringmode'. While in stringmode, all character's ASCII values are pushed onto the stack until the next quote. When the program deals with the stack, it starts with the right most value, therefor going through out message from right to left. The result after the second quotation mark should look something like this:
33,100,108,114,111,119,32,111,108,108,101,72
>:#,_@
The last portion of code prints our message. The underscore (_) works as a horizontal 'if' statement that pops the rightmost value off of the stack and checks if it is zero or not. If it is, the direction of the pointer is set to the right, ending the program with an 'at' sign (@) in this case. Otherwise, the pointer heads to the left.
Because of the way the 'if' statement works, there are some things we have to add to get our message out. Since the 'if' statement pops a value off of the stack, we need to copy what is currently there to make sure that we can still print it. That is what the colon (:) and the comma (,) do in our program. The colon duplicates the last value of the stack and the comma pops the last value and outputs it as an ASCII character. The pound sign (#) skips over the next command in the current direction. If the pointer is going to the right, we would skip the comma, to the left, the colon. We use this to control the flow of the program. Here is what the pointer would look like for one iteration of the program.
>:#,_@ Pointer goes to the right ^ >:#,_@ Duplicate ^ >:#,_@ Skip ^ >:#,_@ Pop and Check (72!=0), go to the left ^ >:#,_@ Print (72) ^ >:#,_@ Skip ^ >:#,_@ Pointer to the right (repeat until finished) ^
Once the program finishes, you should have:
Hello World!
C
Using gcc
Debian Based Systems
Install gcc
$ sudo apt-get install gcc
Red Hat Based Systems
Install gcc
$ su # yum install gcc
All Distributions
After you have installed gcc
using instructions above.
Create helloworld.c
.
This uses HERE
document and bash
, the standard shell.
$ cat > helloworld.c <<HERE #include <stdio.h> int main( int argc, char *argv[] ) { puts( "Hello World!" ); return 0; } HERE
Compile it using gcc
.
$ gcc -o helloworld helloworld.c
Run it
$ ./helloworld
C++
Create text file helloworld.cpp
#include <iostream> int main( void ) { cout << "Hello, World!" << '\n'; return 0; }
Compile it using gcc
:
$ gcc -o helloworld helloworld.cpp
Run it:
./helloworld
Clojure
- Install Leiningen.
- Generate a hello world app: <lang>$ lein new app my-hello</lang>
- Run it: <lang>$ cd my-hello
$ lein run Hello, World!</lang>
- Edit the generated src/my-hello/core.clj file with your favorite texteditor to make changes.
- You don't have to edit files. Run the REPL (interactive shell) to experiment: <lang>$ lein repl</lang>
- Suggested reading: Clojure's Getting Started Guide and Clojure for the Brave and True
COBOL
1) Install OpenCOBOL: <lang>$ sudo apt-get install open-cobol</lang> 2) Open your texteditor, and write the following code: <lang cobol>program-id. hello-world.
procedure division.
display "Hello, World!"
goback .</lang>
3) Save the code to hello.cob, and compile it with OpenCOBOL. Note: if OpenCOBOL fails with the error 'unexpected end of file', add a trailing newline after the last period. Other likely errors may be caused by omitting the periods. <lang>$ cobc -x -Wall -free ./hello.cob</lang> 4) Run the compiled program from the command line: <lang>$ ./hello Hello, World!</lang>
Common Lisp
Common Lisp is a dynamically-typed, garbage-collected language whose features have inspired dozens of other languages including Python, Perl, Ruby, Smalltalk, and even Java. Lisp is the second oldest programming language still in use today after Fortran. Lisp has AST macros, which are only just starting to be experimented with in other languages such as Nemerle and BOO. AST macros allow the programmer to define new language constructs that seamlessly integrate with the built-in ones.
Installation
Choosing an Implementation
As a standardized language, ANSI Common Lisp has multiple implementations. LispWorks and AllegroCL are well-known commercial implementations, while the list of free implementations is extensive. Among the free implementations, SBCL is the most popular. It includes a native compiler that generates fast code, supports threads, and has a C foreign function interface. Common Lisp programs compiled with SBCL are generally competitive with Java programs.
Choosing an Editor
The commercial implementations come with their own IDEs, while EMACS is the most popular editor to use for the free implementations. SLIME is an EMACS extension that provides integration between Lisp and EMACS. It enables you to evaluate the Lisp expression at the cursor, provides tooltips, debugging, and more. SLIMV is an extension for Vim that brings SLIME to that editor.
Editing Code
The preferred way to develop Lisp programs is interactively. Evaluate each function, macro, and variable definition in the REPL as soon as you type it into your source file. You can also evaluate subexpressions, and switch to the REPL window to play around with your code as if your functions were shell scripts. Lisp programs are typically written from the bottom up, the idea being to create a language that is perfectly tailored to writing your application, and then writing your application in that language. Output or errors are displayed immediately in the REPL window.
Hello World
hello.lisp <lang "Common Lisp"> (format t "Hello world!~%") </lang>
Running It
Exactly how to run it from the command line depends on your Lisp implementation. Of course, from the REPL you can always
run it by entering:
<lang "Common Lisp">
(load "hello.lisp")
</lang>
...which is also how you load source files in order to add their definitions to your program.
SBCL has the save-lisp-and-die
function, which saves whatever has been defined in the REPL into a stand-alone executable that includes a copy of SBCL itself (because Lisp programs can generate, compile, and run additional Lisp code at runtime, and then reference functions and variables created by that generated code).
D
There is detailed information in The Hello World Program chapter of the online book Programming in D.
Here is a summary:
1) Download and install the latest dmd at dmd download page.
2) Open your favorite texteditor, write the following source code
<lang d>import std.stdio;
void main() {
writeln("Hello world!");
}</lang>
3) Save the source code under the name hello.d
4) Open a console window and compile the source code by entering the following command
dmd hello.d
5) Start the program on the console by entering the following commandz
hello
The program should produce the following output:
Hello world!
EchoLisp
Requirements and installation
You need a computer running an up-to-date browser, such as FireFox, Chrome, Opera, ... No installation needed. To run EchoLisp, follow this link : EchoLisp.
Hello World
<lang lisp>
- This is a comment
- Type in the following -uncommented- line in the input text area, and press [RETURN]
- or click onto the "Eval" button
- Auto-completion
- You will notice that after "(di" , EchoLisp proposes "(display" :
- Press the [TAB] key to accept
(display "Hello, World" "color:blue") </lang>
On-line help
The first thing to know are the "apropos", "usage", and "help" functions. Examples: <lang lisp>
- usage give the syntax(es) for a function call
- "usage" abbreviation is "us"
(us display) → 📗 (display object css-style-string) (display object)
- help opens the reference manual at the right place, in a browser tab
- "help" abbreviation is "?"
(? display) → [1]
- searching
- (apropos name) displays the list of functions about 'name'
- "apropos" abbreviation is "ap"
- 'special' forms (you will learn that later) are flagged with 👀
- 1
- 2 is the number or arguments. min 1, max 2
(ap list) → #(👀 for*/list:2:n 👀 for/list:2:n alist?:1 circular-list:1:n list->stack:2
list->vector:1 list-index:2 list-ref:2 list-sort:2 list-tail:2 list:1:n list?:1 maplist:2 set-plist!:2 stack->list:1 stream->list:1:2 string->list:1 sublist:3 symbol-plist:1 vector->list:1 )
- Or you can press the "Help" button.
- Lost in the reference manual ?
- Just type-in a letter, and you will go to the alphabetical index.
</lang>
Editing
Functions are provided to save data, functions definitions, in the browser local storage, without leaving the read-eval-print loop. However you can edit files, using any text file editor - UTF-8 compatible - and load/eval them with the "Load" button. TextWrangler is a good choice on Mac OS/X. It supports syntax hiliting for source lisp files. In any case, the EchoLisp team is ready to help you.
EDSAC order code
If the year is 1950, first write to Dr Wilkes at St John's College asking him whether you can submit a job to the electronic brain. Assuming he is agreeable, copy out your program—legibly!—and take it round to the keypunch operator at the Mathematical Laboratory.
If it is the present day, Nishio Hirokazu's browser-based simulator allows you to run EDSAC programs without installing anything. Navigate to this page and click the Source tab. Clear the text area (it will contain a 'Welcome' program) and type or paste your program. When you have finished, click the Machine tab and then the button marked Load source. You should see your program, stripped of comments, newlines, and whitespace, appear in the Input tape. Click Run. The machine will first execute the Initial Orders, loading your program into storage, and then run your program. The storage tanks are displayed down the left-hand side of the window: clicking on any tank allows you to watch that tank in a larger size.
Eiffel
Example
- Download and install Eiffel GPL on your Windows computer.
- Open Eiffel, creating a new Basic command line project (follow the wizard).
The resulting program will be a simple "Hello World!" program:
<lang eiffel> class
APPLICATION
create
make
feature
make do print ("Hello World!") end
end </lang>
Where the following notes apply:
- <lang eiffel>class APPLICATION ... end</lang> defines the simplest form of an Eiffel "class".
- <lang eiffel>create make</lang> defines a "creation procedure" (i.e. constructor) for the class {APPLICATION}.
- <lang eiffel>make do ... end</lang> is the implementation of the constructor specified with the `create' keyword (above).
- <lang eiffel>print ( ... )</lang> is a feature inherited from class {ANY}—a class from which all Eiffel classes inherit (e.g. like {APPLICATION}). In the example the <lang eiffel>inherit ANY</lang> has been left out as it is implied by default.
Supported Platforms
Windows, Linux, Mac, and others.
Supporting Notes
See [Eiffel-org] for more information.
An example of "Hello World!" is on the home page. You can try Eiffel by clicking the "Play with Eiffel" button on the "Hello World!" example on the home page.
You can find plenty of YouTube videos on the Eiffel Software [Eiffel Videos] channel or [Eiffel Videos] channel.
Erlang
Erlang on Linux
Here is a summary:
1) To install Erlang in Linux, open a terminal and run the command:
sudo apt-get install erlang
2) Open your texteditor, write the following source code:
<lang erlang>% Implemented by Arjun Sunel -module(helloworld). -export([main/0]).
main() ->
io:fwrite("Hello world!\n").</lang>
3) Save the source code under the name helloworld.erl
4) Open a terminal, hit enter after typing the following command.
erl
5) Compile the source code by entering the following command
c(helloworld).
6) Run the code by calling the main() function using the command:
helloworld:main().
The program should produce the following output:
Hello world! ok
Fortran
Linux
- install gfortran
For Debian-based GNU Linux OS:
sudo apt-get install gfortran
For RPM-based GNU Linux OS:
su -c "yum install gcc-gfortran"
or
sudo zypper in gcc-fortran
or
sudo rpm -ihv gcc-fortran
Note differences in package names that provide gfortran compiler in different Linux distros.
- Create hello.f90 source code file. You can also use any text-editor (ed, joe, pico, nano) but here is shown how to create such file directly in terminal using "cat" command. Open terminal and hit enter after typing the following command.
cat > hello.f90
- Type in the following Fortran source code
write(*,*) "Hello world!" end
and finally hit Ctrl^D in terminal.
- Compile hello.f90 source code into executable hello.x binary using gfortran compiler
gfortran hello.f90 -o hello.x
- Run it
./hello.x
FutureBasic
Requirements
Macintosh OS X v10.4 or newer
Download FutureBasic (FB)
FutureBasic is freeware and is commonly called simply "FB" by its developers. The lastest version of FutureBasic can be downloaded from [2]. The FB site also contains installation instructions, example files, older versions, and other helpful information.
FB Support Group
An active list group of developers who are knowledgable, friendly and helpful to both seasoned and newcomer coders can be found at [3]. Answers to any of a host of questions about FB are answered quickly by this small, but dedicated group of developers.
FB on Wikipedia
The FB Wikipedia page describing FB's journey from one of earliest commercial Macintosh compilers to its current freeware status can be visited at: [4]. This page may not have the latest information about FB, so the authoritative source for the latest information is the FB web site and list group listed above.
=== Your First Program ===
When you have downloaded and installed FB, you will want to compile your first program, the traditional "Hello, World!"
1. Launch FB and from the File menu select New File.
2. Name your file "Hello, World!" and save it to your Desktop.
3. In the window type the following:
<lang futurebasic> include "ConsoleWindow
print"Goodbye, World!" </lang>
4. From FB's Command menu, select Build and Run "Hello, World!"
Enjoy your first program!
Go
Currently supported platforms are FreeBSD, Linux, Mac OS X, and Windows. From the landing page http://golang.org click the blue box "Download Go" (under the big gopher drawing.) This takes you to Getting Started, a fairly concise page that is very close to satisfying this task.
The first section, Download, has a link to a downloads page but also mentions two other options, building from source and using GCC. I personally like building from source and have found it usually goes without a hitch. GCC isn't just C anymore and includes a number of language front ends. Go is one of them. There are links there to separate pages of instructions for building from source and using GCC.
Continuing with instructions for the precompiled binaries though, there is a section "System Requirements" and then a section "Install the Go tools", which means tools including the Go compiler. You need to follow some steps here. Follow the instructions for your operating system. (The steps are few, standard, and easy.) Pay attention to the paragraph "Installing to a custom location" if you are installing on a system where you do not have root or sudo access. Setting GOROOT as described is essential in this case. If you are installing to the standard location, you should not set this environment variable. (Setting it when it doesn't need to be set can lead to problems. Just don't.)
You're ready to test the installation with Hello World! The RC Task mentions texteditors. You will want an editor that can edit Unicode UTF-8. Go source is specified to be UTF-8 and before long you will want an editor that does this. This task is all ASCII however, and any editor that can save plain ASCII text will do for the moment. Actually you probably don't even need an editor. From a Linux command line for example, you can type
$ cat >hello.go
Cut and paste the code from Hello_world/Text#Go, press ^D, and you should have the program. To run it type
$ go run hello.go
This compiles to a temporary executable file and runs it, displaying output right there in the same window. If you want a copy to give to your friends,
$ go build hello.go
will create an executable called hello in the current directory.
This completes the RC task, but if at any point in the future you will use Go for more than Hello World, you really really should continue through the next section "Set up your work environment." This covers setting GOPATH, which is essential to standard workflow with Go.
Groovy
First you need to have a JRE or better a JDK 1.5+ installed on your machine. Install Groovy following the instructions at: Groovy Installation
In your repository Just type: (no class, no parentheses, no semicolon, no import) <lang "Groovy">println 'Hello to the Groovy world'</lang> and save it in hello.groovy On the command line, just type
$> groovy hello.groovy
You will see the following message:
Hello to the Groovy world
Note you can also define a String to test the output message example, in your hello.groovy file replace previous code by: <lang "Groovy">String hello = 'Hello to the Groovy world' println hello</lang> And you can add some assertions, for instance: <lang "Groovy">assert hello.contains('Groovy') assert hello.startsWith('Hello')</lang>
Haskell
Install GHC: <lang>$ sudo apt-get install ghc</lang> Create hello.hs: <lang>$ touch hello.hs $ cat > hello.hs << HERE main = putStrLn "Hello, World!" HERE</lang> Compile it: <lang>$ ghc hello.hs -o hello</lang> And run the executable: <lang>$ ./hello Hello, World!</lang>
Non-Linux operating systems
If you are using another operating system (e. g. Mac OS X), the easiest way to get Haskell is to install the Haskell Platform.
J
Download J804 from http://jsoftware.com/stable.htm
Install it, using the defaults.
Run the program, and bring up the IDE.
Type in: <lang j>'Goodbye, World!'</lang>
jq
The official jq homepage at http://stedolan.github.io/jq has an introduction and pointers to instructions on downloading jq; a tutorial; a manual; an online jq interpreter called jqplay; and so on.
The website is well-organized and intended for newbies as described on this page, and so the following will avoid repeating the same information. Instead we will explore the "Hello world!" task in the context of both jqplay and the jq command. As will become evident, an editor is not always necessary. In practice, though, jq is typically used in conjunction with a text editor as discussed in the penultimate subsection of this article, which concludes with a note on programming style.
jqplay
jq is primarly intended for use as a command-line tool, but the online tool at jqplay.org can also be used for simple tasks. In fact, it is instructive to consider two approaches to the "Hello world!" task using jqplay:
1) "Hello world!" as data
"Hello world!" can be regarded as a JSON string, and it can be entered in the JSON input box. The program for printing it is just "." (without the quotes). That is, using jqplay, one simply enters . in the "Filter" box.
2) "Hello world!" as program
Since any JSON entity is a filter in jq, we can also enter "Hello world!" in the Filter box. In this case, no additional data is required, and so the "Null input" box can be checked.
The jq command
With jq installed, we can explore the two approaches mentioned above at the command prompt.
In the following we will use C:\ to signify the context is a Windows terminal, and $ to signify that the context is Linux/Unix/Mac/Cygwin or similar.
1) "Hello world!" as data
The data can come from stdin or from a file:
Data from stdin <lang sh>$ echo '"Hello world!"' | jq .
C:\ echo "Hello world!" | jq .</lang> If there were a web server somewhere that provides "Hello world!" as JSON, then we could also write something like: <lang sh>curl -Ss http://hello.world.com | jq .</lang>
Data from a file <lang sh>$ echo '"Hello world!"' > hello.txt $ jq . hello.txt
C:\ echo "Hello world!" > hello.txt C:\ jq . hello.txt</lang> 2) "Hello world!" as program <lang sh>$ jq -n '"Hello world!"'
C:\ jq -n "Hello world!</lang> We could also put the program into a file. In this particular instance, we could use the file hello.txt that was created above. In this particular case also, the command is the same in all the environments under consideration: <lang sh> jq -n -f hello.txt .</lang> In practice, it is recommended that jq programs be placed in text files with names ending with the .jq suffix.
Editors
Any text editor can be used for JSON and jq programs.
An editor such as Emacs or Aquamacs is particularly helpful as these support shell windows. In addition, most distributions come with "js-mode" which can be used for editing JSON, and there is also a "json-mode" package available at https://github.com/joshwnj/json-mode.
A note on jq programming style
jq programs consist of definitions and pipelines. There is much to be said for a style illustrated by the following example: <lang jq>def binary_digits:
if . == 0 then 0 else [recurse( if . == 0 then empty else ./2 | floor end ) % 2 | tostring] | reverse | .[1:] # remove the leading 0 | join("") end ;</lang>
Locomotive Basic
Either use a browser-based CPC emulator (http://www.cpcbox.com/) or download a binary for your platform. A list of emulators is available at http://cpcwiki.eu/index.php/Emulators. JavaCPC (http://sourceforge.net/projects/javacpc/) or WinAPE (http://www.winape.net/) are particularly recommended. An advantage of native emulators is that they tend to have copy-and-paste functionality, so you can edit programs in external texteditors.
In the emulator, type
<lang locobasic>10 print "Goodbye, World!" run</lang>
Mathematica / Wolfram Language
Buy & Install the program from http://www.wolfram.com/mathematica/, e.g. "Home - For nonprofessional use by hobbyists and enthusiasts" --> €295
Start Mathematica either :
- by calling math.exe(Windows) or math (Others)
- by double clicking on the Mathematica icon.
Open a new notebook and type : Print[ "Goodbye, World!"]
Monte
Follow the directions at http://monte.readthedocs.org/en/latest/intro.html#where-do-i-start to set up your Monte environment.
Then
$ bin/monte monte/src/examples/hello.mt
The code in hello.mt simply defines a function and then calls it:
<lang monte> def sayHello():
traceln("Hello World")
sayHello() </lang>
Nemerle
- Download Nemerle from Nemerle.org
Nemerle on Windows
The installer available on Nemerle.org includes Visual Studio integration. If you use Visual Studio, this gives syntax highlighting, name completion, etc. Otherwise, you can use your favorite texteditor or IDE.
In your text editor, type (or copy/paste):
using System.Console; class Hello { static Main() : void { WriteLine("Goodbye, world."); } }
or, more concisely:
System.Console.WriteLine("Goodbye, world.")
Save this file as "hello.n" (or whatever you like, but the example below assumes this name)
Now, either run it from within your IDE, or open a console window and type:
c:\>ncc hello.n
(this assumes ncc.exe is in your path, where it should be if you used the installer)
The output file will be out.exe; run out.exe as so
c:\>out
and be dazzled by the output:
Goodbye, world.
OCaml
Prerequisites: Ocaml Download: On Linux, Ocaml should be available in your package manager.
Create file: 'hello.ml'
Type in file: <lang ocaml>print_string "Hello world!\n";;</lang>
Compile with: <lang Shell>ocamlc -o hello hello.ml</lang>
Run as: <lang Shell>./hello</lang>
Oforth
Select one of the Oforth implementation to download : http://www.oforth.com
Copy oforth directory at a location of your choice.
Set OFORTH_PATH environnement variable value to this directory. You can also add this directory to your PATH variable in order to be able to launch Oforth from everywhere.
Create file "hello.of"
Type in file:
<lang Oforth>"Hello world!" println</lang>
Run as: <lang Shell>oforth hello.of</lang>
Or you can use oforth command line directly :
<lang Shell>oforth --P"\"Hello world!\n\" println"</lang>
Pare
Prerequisites: Perl
Download: https://bitbucket.org/parelang/pare/downloads/pare
Create file 'hello.l': <lang Pare>(print "hello world")</lang>
Run: <lang Shell>perl pare hello.l</lang>
PARI/GP
PARI's official site is http://pari.math.u-bordeaux.fr/ .
PARI/GP on Windows
Go to the download page of the PARI/GP website and download one of the following:
- The latest self-installing binary distribution 2.4.2. This is the most full-featured but lacks some of the newer bugfixes and commands.
- The basic GP binary 2.5.0. This lacks some features like high-resolution graphing but has newer features.
- The SVN version 2.6.0. This has the bleeding-edge features but lacks many nicities and may contain bugs.
PARI/GP on the Mac
Install the latest available gp version on
or
PARI/GP on Linux
Install PARI/GP with an appropriate package manager: RPM, apt, etc. Alternately, install it from source.
Your first program
Open a texteditor of your choice and type
<lang parigp>print("Hello, world!")</lang>
Save the file in your PARI working directory and start the program, either in a console (command: gp
) or in the GUI in Windows (by double-clicking the shortcut). Type \r filename
to read in the program. (If you saved the file with a .gp extension, you can leave it off here.)
The program executes, displaying "Hello, world!".
PHP
PHP can be run either from the command line or via a web server such as Apache. If you are running Mac or Linux, PHP is likely already installed. If you are on Windows, you can set up your own web server locally by using XAMPP (https://www.apachefriends.org/index.html).
Create the file, hello.php, in your htdocs or public_html directory.
<?php echo 'Hello, world!'; ?>
If Apache is running on your local computer and you saved the file in htdocs, open a web browser and go to http://localhost/hello.php. You should see the phrase in a basic font displayed in the window.
From the command line, simply type
php ./hello.php
PicoLisp
Debian-based systems
Install
$ apt-get install picolisp
then run it
$ pil + : (prinl "Goodbye, World!")
Other POSIX systems
Fetch and unpack the tarball
$ wget software-lab.de/picoLisp.tgz && tar xfz picoLisp.tgz
then build the executable (see http://software-lab.de/INSTALL file for 64-bit systems)
$ cd picoLisp $ (cd src; make)
and run it locally
$ ./pil + : (prinl "Goodbye, World!")
Non-POSIX systems
On non-POSIX systems only limited implementations of PicoLisp are available.
If Java 1.6 is installed, get and unpack either the tarball given in "Other POSIX systems", or just "software-lab.de/ersatz.tgz", and run
$ ersatz/pil : (prinl "Goodbye, World!")
(see also http://software-lab.de/ersatz/README).
If no Java is available, you can compile "software-lab.de/miniPicoLisp.tgz" and run it
$ ./pil + : (prinl "Goodbye, World!")
Perl
See Download Perl Distributions <lang perl>=head1 Obtaining perl
On the majority of UNIX and UNIX-like operating systems (Linux, Solaris, AIX, HPUX, et cetera), perl will already be installed. Mac OS X also ships with perl. Note that "Perl" refers to the language while "perl" refers to the interpreter used to run Perl programs.
Windows does not ship with perl. Instead, you will have to install one of the following perl distributions:
=over 4
=item Strawberry Perl
L<Strawberry Perl|http://strawberryperl.com/>: A 100% Open Source Perl for Windows that is exactly the same as Perl everywhere else; this includes using modules from CPAN, without the need for binary packages.
=item DWIM Perl for Windows
L<DWIM Perl for Windows|http://dwimperl.com/windows.html>: A 100% Open Source Perl for Windows, based on Strawberry Perl. It aims to include as many useful CPAN modules as possible.
=item ActiveState Perl
L<http://www.activestate.com/activeperl/downloads>
=back
Links and further instructions on installation can be found on L<http://www.perl.org/get.html>.
Once perl is installed, the task of printing "Hello, World!" is quite simple. From the command line, first check if your environment's C<PATH> variable knows where to find perl. On most systems, this can be achieved by entering C<which perl>; if it spits out something like F</usr/bin/perl>, you're good to go! If it tells you
which: no perl in (...)
it means you need to add perl to your environment's C<PATH> variable. This is done on most systems by entering
export PATH=$PATH:[...]
where [...] is the full path to your perl installation (usually /usr/bin/perl).
If you do not have the C<which> command, you can probably just type C<perl> to see if it fires up the perl interpreter. If it does, press Ctrl+D to exit it and proceed. Otherwise, perform the steps above to add perl to your PATH variable.
Once perl is installed, one-liners can be executed from the command line by invoking perl with the C<-e> switch.
$ perl -e 'print "Hello, World!\n";'
To create a script file that's more permanent, it can be put in a text file. The name can be anything, but F<.pl> is encouraged. The #!/usr/bin/perl at the beginning is called the shebang line; if the operating system supports it, it tells where to find the perl interpreter. If the script is run with C<perl>, this line will be ignored-- this is for invoking the file as an executable.
=cut
- !/usr/bin/perl
print "Hello, World!\n";</lang>
Perl 6
Perl 6 is a language spec and test suite, not an implementation. Any implemention which implements the spec and passes the test suite can call itself perl 6. Philosophically, there is no official "Perl 6 distribution". Practically, at this point (late 2015), Rakudo perl 6 is the only realistic option. There are others, but they are either not currently being developed or far behind Rakudo in functionality.
There are several ways to get and install Rakudo perl 6 depending on your operating system and the balance between your technical familiarity and tolerance of outdated code. Rakudo perl 6 is still in heavy development and the code base still has features being added, refined and optimized on a daily basis; a few weeks can make a big difference.
For ease of installation, there are MSI files for Windows, Homebrew packages for OSX and pre-built Linux packages for apt and yum based packaging systems. They will get you a working compiler most easily, but may be weeks or months out of date.
At least until Rakudo makes it out of beta, it is probably best to build from source.
All of these options are detailed on the Rakuko.org website: http://rakudo.org/how-to-get-rakudo/ .
If you do run into problems installing Rakudo, (or any perl 6 compiler, or have any Perl6 questions,) the #perl6 IRC channel on freenode.net nearly always has people willing to help out.
Once you have your compiler installed, open a terminal window and type:
perl6 -e'say "Hello World!"'
or, under Windows cmd.exe,
perl6 -e"say 'Hello World!'"
and press enter.
Alternately, type
echo say 'Hello World!' > hw.p6
then type
perl6 hw.p6
to execute it.
Note that the file name may have any extension or none at all.
PowerShell
Windows PowerShell should be already installed in Windows 7 and Windows 8.
Accessing PowerShell
There are 2 ways to access Windows Powershell:
- Open Command Prompt, then type "PowerShell".
- Click the Start Button, then All Programs, then Accessories, then Windows PowerShell. From there you will find the PowerShell Console (a big blue one), and the Windows PowerShell ISE (Integrated Scripting Environment).
Executing the "HelloWorld" Code in Console
Now, to execute your first code in PowerShell, choose from the two options above to access the PowerShell console. If the console is already open, type any of these codes: <lang powershell>"Hello, World!" #This is a comment.</lang> or, <lang powershell>wRiTe-HOsT "Hello, World!" #PowerShell is case-insensitive.</lang> or, <lang powershell>Write-Host Hello`, World! #The backtick escapes the next character.</lang> Your output should be:
Hello, World!
Writing and Executing Your First PowerShell Script
These are the ways to write/edit a PowerShell script:
Using a Simple Text Editor:
To make the "HelloWorld" code in a script file, copypaste the code (select one) above, and then save it as "<filename>.ps1".
To execute the script, open the PowerShell console, go to the directory of the script file, then type ./<filename>
.
Using the Windows PowerShell ISE:
It is recommended to use the PowerShell ISE if you are new to PowerShell. Copypaste the code (select one) above, then run the code by clicking the play button or by pressing F5.
Exploring PowerShell
To learn the basic syntaxes and details of PowerShell, Open the PowerShell ISE, then press F1 to open the Windows PowerShell "Getting Started" Guide.
Python
Pythons official home site is http://www.python.org/. It will point you to everything Python.
Python on Windows
(Tested on Windows 7 but should be similar for XP & Vista ).
You need to download and install Python. Use the latest Windows installer for Windows (64bit if you have a 64bit Windows installation). It is a standard Windows click-through installer with an Open-source compatable license.
Once installed, use the new start-menu entry to open the "Idle (Python GUI)" application, which opens a GUI window with a command line and cursor at the bottom. This window displays program output and is a REPL for Python.
Use the File->New window item of the GUI to bring up new blank window
and copy the text from Hello world/Text#Python into it,
i.e. <lang python>print "Goodbye, World!"</lang>
use the File menu to save the file with a name hello.py,
(remember the .py extension).
Use the "Run -> Run module
" menu item
from the hello.py Idle editor window to pop the Idle Python shell window to the front whilst executing the program.
The output of the program appears in this shell window as the line:
Goodbye, World!
(Followed by a prompt that is part of the REPL of the IDE rather than programmed by the hello.py file).
Python on OS X
Assuming you didn't delete them by accident, Python 2.x and Python 3.x are already installed. To get started, open the Terminal in your applications folder, and type:
$ echo 'print "Goodbye, World!"' > hello.py
You now have a Python script in your home directory, which you can run with the following command:
$ python hello.py
Alternatively, you can work with Python's IDE, IDLE, the same way as described above for Windows, by typing:
$ idle
You can also execute scripts by including a shebang and using the chmod command as described below for GNU/Linux.
Python on GNU/Linux
On most Linux distribution, just install the package named python
with the package manager.
If you are using a mainstream Linux distribution, installing Idle along with Python gives you a GUI and two ways of working with your code. The easiest is through Idle, see the Windows instructions above for details. The other is outlined below:
A script can be executed with the command:
python my_script.py
or adding a shebang at the first line of the script:
$ head -n 1 my_script.py #!/usr/bin/env python $ chmod a+x my_script.py $ ./my_script.py
- install Python, as above
- install VPython: at vpython.org, select the download for your system:
- To edit/run programs from the IDE, instead of IDLE use VIDLE (it loads the vpython-extensions, and helptexts)
- Look at some example programs -- for example, bounce.py
- (on Windows, they should be located at C:\Python27\Lib\site-packages\visual\examples)
- Try some programs from RC -- for example, Draw a cuboid
Ra
Requirements
- Cobra
- All Cobra requirements
Download
Download the latest version of Ra from GitHub
Installation for Windows
- Unzip the download
- Open a command prompt window as an administrator in the unzipped folder
- Enter the following command: install.exe
- You should see the word "Success"
- Add "C:\Ra" to your PATH variable
Installation for Mac/Unix/Linux/Ubuntu
- Unzip the download
- Open a terminal in the unzipped folder
- Enter the following command: sudo ./install
- Enter your password if prompted to by the terminal
- You should see the word "Success"
Writing Ra Code
Create a plain text file and enter the following text: <lang Ra> class HelloWorld **Prints "Goodbye, World!"**
on start
print "Goodbye, World!" </lang> Save the plain text file as "HelloWorld.racode" (all Ra files must end with the .racode extension).
Running Ra Code
Open a terminal and navigate to the directory where "HelloWorld.racode" is saved. Enter the following command:
ra HelloWorld
You should see "Goodbye, World!" printed to the terminal.
You can optionally include the file extension when running Ra code:
ra HelloWorld.racode
Links
Racket
Installation
Install Racket from the Racket home page.
On Windows and OS X when you have a 64 bit platform, you can install either the 64 bit Racket or the 32 bit one, the installer page will not try to detect this, since both options can be used. The choice will usually not make much difference; a quick summary is that with the 64 bit version you can use much more space (in 32 bit mode there's a 4gb limit), but things are going to run a bit slower due to Racket shuffling more memory around. (This is not Racket-specific, of course.)
On Linux, you can often find a Racket package for your distribution flavor. From the Racket web page you can find a few installers built on different Linux distros, and one of them might fit you even if you're on a different one. The Racket installers come in shell-script form, which you can just run in a terminal (sh installer.sh would do it). The first question that the installer will ask you is whether you want a unix-style distribution, with files spread across standard directories -- the recommendation is to not do this, and instead install Racket in a single directory. This choice makes it much easier to try Racket quickly -- you can just remove the directory when you're done, you can easily have multiple versions installed, and you don't need write permission to system directories.
Developing Racket Code
Racket comes with DrRacket, an IDE that is specifically designed to make Racket work easy (and implemented in Racket). However, you can use your own text editor if you're used to one. See the Racket Guide section on working with different editors, and running Racket from the command line.
As with Common Lisp, EMACS is a good editor to use for Racket code. Its inferior-lisp mode allows you to evaluate Racket expressions from within EMACS, however it doesn't provide debugging, symbol lookup, or other features that are available when editing Common Lisp code with EMACS.
Learning Racket
One of Racket's main points is coming with thorough documentation, which you get with the installation and but you can also view it on-line. Specifically, pay attention to the Getting Started page that will help with a few convenient entry points.
Hello World
Save it as "hello.rkt": <lang "Racket">
- lang racket
(displayln "Hello world!") </lang>
Running it
From BASH
$ racket hello.rkt
On Windows
Click the icon for hello.rkt in Explorer, or click the Run button within DrRacket.
REXX
installation
Each REXX interpreter for a particular operating system has their own requirements, but most involve just copying (usually) two files:
- the REXX interpreter,
- the REXX run-time library (the built-in functions and REXX statement executors).
Note that some operating systems have REXX "built-in", so there
isn't any installation necessary.
The "MVS" and "VM/CMS" IBM mainframe
operating systems have REXX installed (indeed, built-into the operating
system) as well does OS/2 and AS/400.
Note that MVS and VM/CMS are more-or-less generic terms in the IBM world.
program creation
<><>Next, create a REXX program.
Most users use their favorite texteditor (for "plain text").
Note that some operating systems require the first statement
to be a REXX-type comment,
another requires the first word in the comment to be the word REXX
(in any case, upper/lower/mixed).
Most REXX interpreters enforce the first of these two rules.
The reason for this is that some operating systems have more than
one scripting language,
and this first record is used
to invoke the appropriate interpreter.
So, a Hello world! REXX program (two lines) could look like:
<lang rexx>/*REXX program to greet the world enthusiastically. */
say "Hello world!"</lang>
The above program could be made into one statement
(since REXX comments are treated like whitespace).
output
The output (for the SAY instruction) will be shown on the terminal screen (or window).
Hello world!
execution
To execute the program depends on the operating system.
Just placing the program in a special library (or folder) and invoking
the name of the REXX program will execute it.
You could also invoke the name
of the REXX interpreter followed by the name of the REXX program.
For any CMS system, just place the "HELLO EXEC" file on any disk
that is accessed (normally the 'A' minidisk is used).
For Windows (in a DOS window), place the file "HELLO.REX" in the
current directory (folder) or place the file in the folder that is
specified for the REXX interpreter to use when the program can't be found
in the current directory (CD).
Windows class of NT operating systems (NT, XP, and later) can be set up
so that whenever a program (file) that has an extension of (say) REX,
it will be executed (interpreted) by the REXX interpreter (EXE program).
It's possible to have a REXX program without a file extension (filetype),
but that would make it not obvious to what the file's purpose is
and also it'll make it harder to invoke easily.
Ring
<lang ring> sayHello()
func sayHello
see "Hello World" + nl
</lang>
Rust
A complete description of how to install the language can be found on the Install page of the Rust web site. However, for the purposes of trying out code examples, use the online REPL which allows you to enter code, compile it and run it within a single browser window.
<lang rust>fn main() {
println!("Hello world!");
}</lang>
Scala
A complete and actual description can be found on the Getting started guide on the Scala site.
Run a program using Windows PowerShell: <lang Scala>scala -e 'println(\"Hello_world\")'</lang> The double quotes have to be escaped.
SETL
Get the suitable precompiled executable for your platform from the SETL Website. The 'setl' command works in conjunction with 'setlcpp' and 'setltran' so you may want to copy them all over to /usr/bin/ (or equivalent).
Run in-line commands <lang Bash>setl 'print("Hello, world!");'</lang> or create a file 'myscript.setl' <lang SETL>print("Hello, world!");</lang> and run it <lang Bash>setl myscript.setl</lang>
Documentation on the setl command can be found here and a paper on the SETL language can be found here.
Smalltalk
Pharo Smalltalk
Installation
Currently supported platforms are Linux, Mac OS X, and Windows. From the landing page http://pharo-project.org click the "Download" button in the upper right hand corner. You should see a new page with options for downloading a ZIP file for your operating system. Unzip the downloaded file and open Pharo. You may see some windows open. You can read through them and then close them.
Pharo is a live coding environment. You can inspect the entire system at any time using the tools provided. One such tool is called a Workspace. To open a Workspace, CTRL+click anywhere in the background of Pharo and select "Workspace" from the pop-up menu. A window titled "Workspace" will appear and that window should be empty. To log output, you use the Transcript. You can open the Transcript by executing CTRL+click, then selecting Tools > Transcript from the pop-up menu. Because Pharo is a live programming environment, you can also open the Transcript programmatically, which we will do in the next section.
Code
Copy the following text into the "Workspace" window:
Transcript open. Transcript show: 'Hello world'.
This code will, when executed, open a new Transcript window and then output "Hello world" to the Transcript.
Execution
To execute the code in the Workspace, select both lines, then CTRL+click in the Workspace and select "Do it" from the pop-up menu. A new Transcript window should open and you should see "Hello world" in the Transcript.
Swift
Installation
If you haven't installed Xcode already, then please go to the App Store for Mac and install the Xcode program. This will allow for Swift development on both OSX and IOS.
Use the playground
For most code examples, as from this site, you are able to enter them directly in a playground. That is start up Xcode, and either choose the playground from the default startup menu, or select File > New > Playground.
Within this window you are able to write code on the left hand side of the window, and the output is shown on the right hand side. If you have errors in your code, this might prevent the output, but in this case the window displays error icons and some explanations.
Swift Tutorial and Example Playground
Downloading GuidedTour.playground from the book "The Swift Programming Language" available for free from Apple book store, can be opened and this has a lot of examples of the basic structures and how to do different stuff in Swift.
Tcl
Installation
Many operating systems come with a distribution of Tcl, though it is often of an old version (Tcl 8.4 or occasionally before). Some also provide Tcl 8.5; it is not normally a problem to have both on your system at once, provided software is not coded to use a version-less executable name. As of the time of writing, nothing comes with Tcl 8.6.
Installing Tcl 8.5 on Linux
Your distribution will probably include a package for 8.5 in its distribution, often named something like “tcl8.5”. Many of the tasks here on Rosetta Code also require Tcllib, a collection of scripted Tcl packages; some distributions provide this as well.
Installing Tcl 8.5 on Windows and OSX
You are recommended to use ActiveState's Tcl distribution, which is of very high quality.
Installing Tcl 8.6
As of the time of writing, ActiveTcl is the only “full service” distribution of Tcl 8.6.
Running your first Tcl code
Going to a command prompt and typing:
tclsh8.5
(or tclsh85
on Windows) will start an interactive Tcl shell.
At the prompt, you can just type in Tcl commands and have them executed immediately.
For example, if you type in this little program:
<lang tcl>puts "Hello World"</lang>
You will get this message printed out:
Hello World
before another prompt symbol. Congratulations! You've just run your first Tcl code.
If you're using ActiveTcl, you can also try typing these examples into the Tkcon prompt. Tkcon's very slightly different, but for most Tcl programs it works just the same.
When running Tcl 8.6, change the tclsh8.5/tclsh85 to be tclsh8.6/tclsh86. If you want the Tk package as well because you're working on writing a GUI, it is often easier to use wish instead of tclsh (with appropriate version number suffix), though it's still the same language. It just has some extra commands.
Running your first Tcl program
Now save that same command in a text file called hello.tcl
.
Any simple texteditor will do (but not a word processor!);
your author often uses Emacs for this, and it comes with automatic
syntax highlighting for Tcl code.
To run that saved code, type one of these:
tclsh8.5 hello.tcl On Linux/OSX tclsh85 hello.tcl On Windows
The code in the file will be executed (printing the message to the screen) and then it the Tcl interpreter will exit. There you go, your first full Tcl program.
Going Further
If you're writing a larger program, you might want to use an IDE. The main two IDEs for Tcl are ActiveState's Komodo (commercial) and Eclipse with the appropriate DLTK module (free to use).
For a range of interesting Tcl programs and techniques beyond what is here on Rosetta Code, check out The Tcler's Wiki.
Documentation for many versions of Tcl is also online, which can be a handy supplement to your system docs.
TI-83 BASIC
The TI-8x series calculators have a built-in BASIC scripter. To access this, press the "PRGM" key. You can create a new program by selecting the "NEW" tab and pressing "ENTER". You will be prompted to enter 8 alphanumeric characters for the name, but it must start with a letter. Most programming functions can be accessed by pressing the "PRGM" key, and all functions can be viewed in alphabetical order by pressing "2nd" then "0".
Type in code so your screen looks like this (where MYPROGRM is the name of your program): <lang ti83b>PROGRAM:MYPROGRM
- Disp "HELLO, WORLD!"</lang>
Disp is found under the "I/O" tab of the menu from the "PRGM" key, the "!" symbol can be found under the "PRB" tab of the menu from the "MATH" button, and quotations are "ALPHA" then "+".
When writing programs, it is much faster to know the shortcuts for certain common functions. Any list in the TI OS can be selected from using the number keys, so "Disp" for instance is "PRGM" then "3".
to exit the editor, press "2nd" then "MODE", and to run the program press "PRGM" and select your program from under the "RUN" tab.
ZX Spectrum Basic
The computer has a basic interpreter build into rom, so there is no need to install an software before entering a program. Switch on the computer. You should see a message as follows:
(C) 1982 Sinclair Research Limited.
Press the number 1 key followed by the number 0 key. (Note this is not the same as the letter O). Now press the P key. This should cause the keyword PRINT will appear in full. The computer knows that a keyword is required, and behaves accordingly. The flashing K cursor indicates that a keyword is expected. You should now see:
10 PRINT
followed by a flashing L cursor. The computer is now in letter entry mode, and is no longer expecting a keyword. Hold down the symbol shift key, and press the P key again. This time you should get a doublequote symbol. Let go of the symbol shift key.The screen should look as follows:
10 PRINT "
Now let go of the symbol shift key, and hold down the Caps Shift key. Press the letter H key. You should now get a capital H. Let go of the Caps Shift key and type the letters ELLO. Now press symbol shift again and press the P key, to produce another doublequote symbol.
You have now typed the first line of the program. Press the ENTER key. The program line will now appear at the top of the screen as follows:
<lang zxbasic>10 PRINT "Hello"</lang>
The cursor returns to a flashing K indicating that a keyword is expected again. Press the letter U. We now get the keyword RUN followed by a flashing L cursor. This time we have not entered a line number, because we want the command to be executed immediately. Press ENTER. The program will run and you should see the following:
Hello
0 Ok 10:1
You have just created and run your first program.