Hello world/Newbie: Difference between revisions

m
No edit summary
 
(15 intermediate revisions by 7 users not shown)
Line 503:
Once the program finishes, you should have:
<pre>Hello World!</pre>
 
=={{header|Binary Lambda Calculus}}==
Although https://www.ioccc.org/2012/tromp/hint.html explains how to compile the obfuscated C code at https://www.ioccc.org/2012/tromp/tromp.c to run
<pre>echo " Hello, world" | ./tromp</pre>
 
I find that the modern clang compiler cannot compile tromp.c
 
Luckily https://github.com/tromp/AIT offers alternative implementations of the lambda universal machine in many languages:
 
* C: uni.c
* Perl: uni.pl
* Python: uni.py
* Javascript: uni.js
* Ruby: uni.rb
 
For example, one can run
 
<syntaxhighlight lang="bash">wget https://github.com/tromp/AIT/uni.pl
echo " Hello, world" | ./uni.pl</syntaxhighlight>
 
More implementations may be found at https://rosettacode.org/wiki/Universal_Lambda_Machine
 
=={{header|BQN}}==
Line 812 ⟶ 833:
<pre>Hello world!</pre>
 
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils,StdCtrls}}
The following instructions apply to any version of Delphi going back to the 1990's. They also apply to Lazurus, which is a Delphi-like programming environment based on Free Pascal.
 
1. You should install Delphi or Lazarus on your computer. Delphi installation disks will automatically install the program and all necessary libraries, editors and tools on your computer. LararusLazarus installioninstallation files can be downloaded from their web site. They will also install all necessary tools.
 
[https://www.lazarus-ide.org/ Lazarus Website]
 
2. Once Delphi/Lazarus has been installed, choose the "File -> New" option from menu bar. Next choose "Application" or "VCL Forms Application" depending on which language or version you are using.
 
This will cause the program to display a blank window called a "Form", with a grid of dots. The dots indicate that the program is in "Design Mode" and it is ready for you to design a GUI interface for your program.
 
[[File:DelphiDesignMode.png|frame|none]]
 
3. At the top of the IDE is a "Component Palette" that displays a bunch of icons. Each icon is an object that you can put on the form.
 
[[File:DelphiComponentPalette.png|frame|none]]
 
Select the "Memo" item by clicking on it once. (It is normally the sixth item from the left.) Now click on the form; a white box should appear. This is an object that allows you to display, enter and edit text. You can move and resize the memo, by dragging the control with the mouse or pulling on the tiny black boxes on the edges of object.
Line 830 ⟶ 859:
4. Double click on the button. This will automatically write a subroutine in the source code and bring up the Delphi/Lazarus source-code editor displaying the subroutine.
 
<syntaxhighlight lang="Delphi">
procedure TForm1.Button1Click(Sender: TObject);
begin
end;
</syntaxhighlight>
 
Between "begin" and "end" statements, enter the following line of code:
 
<syntaxhighlight lang="Delphi">
Memo1.Lines.Add('Hello World');
</syntaxhighlight>
 
The end result should look like this:
 
<syntaxhighlight lang="Delphi">
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Add('Hello World');
end;
</syntaxhighlight>
 
5. You've now completed the program. Press the "Run" button in the upper left portion of the IDE. (It is usually the button with green arrow on it.) The program will now display your form with the button and the memo on it. Press your button. This will cause the "Hello World" to be displayed in the memo.
 
{{out}}
<pre>
 
</pre>
 
=={{header|EasyLang}}==
Line 949 ⟶ 988:
</syntaxhighlight>
# Now it should be compiled (where elc is a command-line compiler):
<syntaxhighlight lang="elena">elcelena-cli.exe program1.l</syntaxhighlight>
# It will create program1.exe file which you can execute:
<syntaxhighlight lang="elena">program1</syntaxhighlight>
Line 1,510 ⟶ 1,549:
# Select "File / New File... (Alt+Ctrl+N)" and create the file "HelloWorld.lean".
# A message may pop up saying "Failed to start 'lean' language server". If that happens, press the button "Install Lean using Elan".
# Write the following in "HelloWorld.lean":
<syntaxhighlight lang="lean">
def main : IO Unit :=
Line 1,517 ⟶ 1,556:
#eval main
</syntaxhighlight>
# Place your cursor a at the end of <code>#eval main</code>, which updates the "Lean InforviewInfoview" showing the message <code>Hello world!</code>.
 
=={{header|Locomotive Basic}}==
Line 1,812 ⟶ 1,851:
 
You've just created and run a hello world program in NS-HUBASIC.
 
=={{header|Nu}}==
The Nu programming language is a part of Nushell. See the [https://www.nushell.sh/#get-nu official installation guide] for up to date instructions. If you are on Linux use your distribution's package manager (search for nushell).
 
Once installed, you can run <code>nu</code> through the command line to get a prompt. Type <code>print "Hello world!"</code> to run the hello program interactively.
 
Transcript (some content redacted for brevity):
 
<pre>
~ $ nu
__ ,
.--()°'.' Welcome to Nushell,
'|, . ,' based on the nu language,
!_-(_\ where all data is structured!
 
[...]
 
~> print "Hello world!"
Hello world!
</pre>
 
Alternatively, save the following text to the file `hello.nu`
<pre>
print "Hello world!"
</pre>
 
This can be done with any text editor, or via the command line.
<pre>
tee hello.nu << EOF
print "Hello world!"
EOF
</pre>
 
Run with <code>nu hello.nu</code>.
 
=={{header|OCaml}}==
Line 2,192 ⟶ 2,265:
 
=={{header|Processing}}==
=== Installing Processing ===
 
== Installing Processing ==
Everything Processing related lives here! -> https://processing.org/
 
Line 2,209 ⟶ 2,281:
Then open the "Processing-(version number)" folder and run 'Processing.exe', processing is now installed!
 
=== Writing your first program ===
To create a new file in processing, navigate to the toolbar at the top of the window, select file, and new.
 
Line 2,944 ⟶ 3,016:
 
=={{header|Wren}}==
Although Wren is primarily used as an embedded scripting language, there is a standalone version called Wren-CLI which can be run directly from the command line. This is available as a pre-built 64 bit executable for Linux, MacOS and Windows and can be downloaded from [https://github.com/wren-lang/wren-cli/releases/tag/0.34.0 here].
 
Having downloaded and unzipped Wren-CLI, the next job is to create a script. Any text editor can be used for this including simple general purpose ones such as gedit, TextEdit and notepad for the operating systems referred to above.
 
So open the text editor, paste in the following script (yes, it's only one line), and save it to a file called ''helloHello_world.wren'' in the same directory as wren-cli itself:
<syntaxhighlight lang="ecmascriptwren">System.print("Hello world!")</syntaxhighlight>
Now type at the command line (omit ./ if using Windows):
<pre>
./wren-cli helloHello_world.wren
</pre>
to compile and run the script and you should see the archetypal greeting :)
56

edits