3

I want to display a string on terminal when the user executes it. But, I want to do this without calling any predicate. For example, if the code is like this:

print_sth(String):-write(String).

it will print some string only if I make an explicit call of that predicate. Instead, when we consult our program I want the view to be something like this:

This is a brief tutorial of the program that was called automatically. 
?- // Ready to call a predicate here, but the string above was displayed when we consulted the program.  

I tried this but it didn't work:

:- write('This is a brief tutorial of the program that was called automatically. ').
some_predicate():- do_sth().
// ... other stuff follows here.

Thank you!

Dionis Beqiraj
  • 737
  • 1
  • 8
  • 31
  • Please explain more precisely, *I tried this* (did you type that directly into a file and include it? Type it at the prompt? Was the `:-` something you typed or was it a prompt?) and please explain more precisely, *but it didn't work* (Error message? Unexpected results?) – lurker Dec 23 '15 at 13:19

1 Answers1

1

:- initialization(writeln('hello world')).

CapelliC
  • 59,646
  • 5
  • 47
  • 90