For Programmers: Free Programming Magazines  


Home > Archive > Prolog > February 2005 > "Hello World" in Visual Prolog









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author "Hello World" in Visual Prolog
Petri

2005-02-14, 8:58 pm

Hi,

I've downloaded Visual Prolog 6.2. Could someone tell me how to make a
simple "Hello World"-program.

Thanks,
P


Phil Quintin

2005-02-16, 9:00 pm

Hi Petri, I expect that you mean a non-GUI program that writes to "standard
output". You should create a "console" project. And then modify the "run"
predicate like this:

run() :-
stdio::write("Hello world\n").

regards Phil

"Petri" <mail_cyberboyREMOVE_THIS@yahoo.com> wrote in message
news:gpaQd.2111$pm.333@reader1.news.jippii.net...
> Hi,
>
> I've downloaded Visual Prolog 6.2. Could someone tell me how to make a
> simple "Hello World"-program.
>
> Thanks,
> P
>



Petri

2005-02-17, 8:58 pm

Thank you, but how do I create a non-GUI program? Can't find such option?


> Hi Petri, I expect that you mean a non-GUI program that writes to
> "standard
> output". You should create a "console" project. And then modify the
> "run"
> predicate like this:
>
> run() :-
> stdio::write("Hello world\n").
>
> regards Phil
>
> "Petri" <mail_cyberboyREMOVE_THIS@yahoo.com> wrote in message
> news:gpaQd.2111$pm.333@reader1.news.jippii.net...
>
>



Phil Quintin

2005-02-19, 8:58 pm

Hi Petri,

> Thank you, but how do I create a non-GUI program? Can't find such

option?

Perhaps I was a bit "short". A non-GUI program is called a "console"
program. Anyway, here is more elaborate description:

Start Visual Prolog and select "Project -> New...".

- Type in a "Project Name" (here I assume "myProject")
- Select UI Strategy = console
- And choose a base directory for your Visual Prolog projects.

Press "Create" and then build your project (Alt-F9). In the project tree you
can see all the files which are in your project. A lot of the files are
"library" files, containing library code, like access to the console.

Your main file is called "myProject.pro" (assuming the project name
"myProject"). If you doubl click it, it will open in an editor.

And then you can change the code as I wrote before.

Finally, you can run the program F9 (or for console programs Shift-F9 is
usually better, becaue that will keep the console window open after your
program terminates.

You can also press F6 to run your program in the debugger (not much to debug
in a hello world program, though).

regards Phil


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com