Hello world/Newbie: Difference between revisions

From Rosetta Code
Content added Content deleted
(J)
Line 22: Line 22:
Type in:
Type in:


<lang j>''Goodbye, World!'</lang>
<lang j>'Goodbye, World!'</lang>



=={{header|Python}}==
=={{header|Python}}==

Revision as of 14:47, 13 November 2011

Hello world/Newbie is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Guide a new user of a language through the steps necessary to install the programming language and selection of an 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 competant 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.
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.

J

Download J602 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>

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.

print "Goodbye, World!"

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 GNU/Linux

On most Linux distribution, just install the package named python with the package manager.

Then 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