Hello world/Text: Difference between revisions

From Rosetta Code
Content added Content deleted
(Creation, inclusion of data from console-only and GUI-only pages.)
 
No edit summary
Line 6: Line 6:
'''Interpreter:''' [[Bourne Again Shell]] (bash)
'''Interpreter:''' [[Bourne Again Shell]] (bash)


#!/bin/bash
<pre><nowiki>
echo "Goodbye World!"
#!/bin/bash

echo "Goodbye World!"
</nowiki></pre>


==BASIC==
==BASIC==
Line 15: Line 14:
'''Compiler:''' [[BASICA]]
'''Compiler:''' [[BASICA]]


10 print "Goodbye World!"
<pre><nowiki>

10 print "Goodbye World!"
</nowiki></pre>


==C==
==C==
Line 23: Line 21:
'''Compiler Suite:''' [[GCC]] 4.0.1
'''Compiler Suite:''' [[GCC]] 4.0.1


#include <stdio.h>
<pre><nowiki>
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Goodbye, World!\n");
return 0;
}


int main(int argc, char **argv)
{
printf("Goodbye, World!\n");

return 0;
}
</nowiki></pre>


==C++==
==C++==
Line 38: Line 35:
'''Compiler Suite:''' [[GCC]] 4.1.2, [[Visual Studio]] 2005
'''Compiler Suite:''' [[GCC]] 4.1.2, [[Visual Studio]] 2005


#include <iostream>
<pre><nowiki>
#include <iostream>
using std::cout;
using std::endl;
int main () {
cout << "Goodbye, World!" << endl;
return 0;
}


==Lua==
using std::cout;
using std::endl;


'''Interpreter:''' [[Lua]] 5.1.1
int main () {
cout << "Goodbye, World!" << endl;


print("Goodbye, World!")
return 0;
}
</nowiki></pre>


or:
==Lua==


print "Goodbye, World!"
'''Interpreter:''' [[Lua]] 5.1.1


<pre><nowiki>
print("Goodbye, World!")
</nowiki></pre>
or:
<pre><nowiki>
print "Goodbye, World!"
</nowiki></pre>
In Lua, parentheses are optional for function calls when there is only one argument and this argument is either a string or a table constructor.
In Lua, parentheses are optional for function calls when there is only one argument and this argument is either a string or a table constructor.


==Pascal==
==Pascal==
'''Compiler:''' [[Free Pascal]]
'''Compiler:''' [[Free Pascal]]
<pre><nowiki>
program byeworld;


program byeworld;
begin
begin
writeln('Goodbye, World!');
writeln('Goodbye, World!');
end.
end.
</nowiki></pre>


==Perl==
==Perl==
Line 78: Line 70:
'''Interpreter:''' [[Perl]] 5.8.8
'''Interpreter:''' [[Perl]] 5.8.8


<pre><nowiki>#!/usr/bin/perl -w
#!/usr/bin/perl -w
print "Goodbye, World!\n";</nowiki></pre>

print "Goodbye, World!\n";</nowiki></pre>


=GUI=
=GUI=
==Visual Basic==
==Visual Basic==
'''Compiler Suite:''' [[Visual Studio]] 2005
'''Compiler Suite:''' [[Visual Studio]] 2005
<pre><nowiki>Module GoodbyeWorld
Module GoodbyeWorld
Sub Main()

MsgBox("Goodbye, World!")
Sub Main()
End Sub
MsgBox("Goodbye, World!")
End Module</nowiki></pre>
End Sub

End Module</nowiki></pre>

Revision as of 20:54, 9 January 2007

In the User Output task, the goal is to display the string "Goodbye, World!"

Text Terminal

bash

Interpreter: Bourne Again Shell (bash)

#!/bin/bash
echo "Goodbye World!"


BASIC

Compiler: BASICA

10 print "Goodbye World!"


C

Compiler Suite: GCC 4.0.1

#include <stdio.h>

int main(int argc, char **argv)
{
  printf("Goodbye, World!\n");

  return 0;
}


C++

Compiler Suite: GCC 4.1.2, Visual Studio 2005

#include <iostream>

using std::cout;
using std::endl;

int main () {
  cout << "Goodbye, World!" << endl;

  return 0;
}

Lua

Interpreter: Lua 5.1.1

print("Goodbye, World!")

or:

print "Goodbye, World!"

In Lua, parentheses are optional for function calls when there is only one argument and this argument is either a string or a table constructor.

Pascal

Compiler: Free Pascal

program byeworld;
begin
 writeln('Goodbye, World!');
end.

Perl

Interpreter: Perl 5.8.8

#!/usr/bin/perl -w

print "Goodbye, World!\n";</nowiki>

GUI

Visual Basic

Compiler Suite: Visual Studio 2005

Module GoodbyeWorld
    Sub Main()
        MsgBox("Goodbye, World!")
    End Sub

End Module</nowiki>