Results 1 to 10 of 297

Thread: "Hello Ubuntu" in every programming language

Threaded View

  1. #1
    Join Date
    Dec 2006
    Xubuntu 15.10 Wily Werewolf

    "Hello Ubuntu" in every programming language

    List made by pp., posted by LaRoza

    ================================================== ================================================== ===

    I've just been inspired by a webpage with 193 examples of "Hello World!" programs.

    I want to make something a just slightly more useful for the beginning programmer.

    Write the most concise, but clearly readable program (call it helloubuntu) according to this specification:
    1. Say: "Hi! What's your name? "
    2. User enters name.
    3. Say: "Hello, (username)! Welcome to Ubuntu!"
    You can also use a simple GUI, like a dialog box, to ask the question, input name, etc. Just make sure the code is elegant and easy-to-understand.

    You can use programming languages, markup languages, shell scripts, or even SQL statements.

    Try not to hog too many languages. Give other posters a fair go at posting their example too. If you are posting an alternative version of code for a language that has already been posted, mention that it is an alternative version.

    I'll start off:

    Ada (using normal fixed-length string)
    with Ada.Text_IO;
    use Ada.Text_IO;
    procedure helloubuntu is
    	username : String(1..30);
    	lastchar : Integer;
    	Put_Line("Hi!  What's your name?");
    	Get_Line(username, lastchar);
    	Put_Line("Hello, " & username(1..lastchar) & "!  Welcome to Ubuntu!");
    end helloubuntu;
    Ada (using the 2005 standard's unbounded-string)
    with Ada.Text_IO, Ada.Text_IO.Unbounded_IO, Ada.Strings.Unbounded;
    use Ada.Text_IO, Ada.Text_IO.Unbounded_IO, Ada.Strings.Unbounded;
    procedure helloubuntu is
    	username : Unbounded_String;
    	Put("Hi!  What's your name? ");
    	Put_Line("Hello, " & username & "!  Welcome to Ubuntu!");
    end helloubuntu;
    Can we beat 193?
    Last edited by samjh; November 27th, 2010 at 02:29 AM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts