Hello world/Text: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 54: Line 54:
'''Compiler:''' any Java compiler should do
'''Compiler:''' any Java compiler should do


System.out.println("Goodbye, World!");
public class Output {
public static void main(String[] args) {
System.out.println("Goodbye, World!");
}
}


==[[Lua]]==
==[[Lua]]==

Revision as of 20:20, 21 January 2007

Task
Hello world/Text
You are encouraged to solve this task according to the task description, using any language you may know.

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

Text Terminal

Ada

Compiler: GCC 4.1.2

with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
  Put_Line ("Goodbye, World!");
end Main;

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;
}

Java

Compiler: any Java compiler should do

System.out.println("Goodbye, World!");

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.

mIRC

Editor: mIRC Script Editor

alias saygoodbye { echo -a Goodbye! }

OCaml

print_endline "Goodbye, World!"

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";

PHP

echo "Goodbye, World!\n";

Python

Interpreter: Python 2.4

print "Goodbye, World!"

UNIX Shell

Interpreter: Bourne Again SHell (bash)

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

GUI

Visual Basic .NET

Compiler Suite: Visual Studio 2005

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