Hello world/Newbie: Difference between revisions
m (typo) |
|||
Line 11: | Line 11: | ||
* 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. |
* 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. |
* You may use sub-headings if giving instructions for multiple platforms. |
||
=={{header|C}}== |
|||
Think of the simplest task possible. |
|||
Then think of the person who you know has the least IQ. |
|||
Try to describe that task to that person as simply and in as much detail as possible. |
|||
Be patient while that person completes the task perfectly, helping him or her whenever he or she may fail or face any difficulties. |
|||
Repeat the above steps for tasks of ever increasing complexity. |
|||
Meditate on what you have learnt. |
|||
Congratulations, you are now a C programmer. |
|||
=={{header|J}}== |
=={{header|J}}== |
Revision as of 06:50, 2 December 2011
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 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.
- 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.
C
Think of the simplest task possible.
Then think of the person who you know has the least IQ.
Try to describe that task to that person as simply and in as much detail as possible.
Be patient while that person completes the task perfectly, helping him or her whenever he or she may fail or face any difficulties.
Repeat the above steps for tasks of ever increasing complexity.
Meditate on what you have learnt.
Congratulations, you are now a C programmer.
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>
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 text editor 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!".
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