Re: repeating

Aleksander Saidi <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Organization ECL
Message-ID <[email protected]>
Dear Cliff Bender,

Try something like that :

 repeat, write('w00t: '), read(Input),(Input=stop,!,stop;write('I\'m 
terribly sorry. I don\'t understand the meaning of that sen'),nl).

The thing is the 'cut' before stop.

You may also write :
repeat, write('w00t: '), read(Input),(once(Input=stop),stop;write('I\'m 
terribly sorry. I don\'t understand the meaning of that sen'),nl).

'once' is better since it has its own cut.

OR :
repeat, write('w00t: '), read(Input),(Input=stop -> stop;write('I\'m 
terribly sorry. I don\'t understand the meaning of that sen'),nl).

if-else (given by '->') is equivalent (you better put '()' around the 3 
parts of a if-the-else)

Regards.

AS


read_line is replaced by read.

Cliff Bender a écrit :

>Hello again,
>
>I'm hoping again that someone can help me. I'd like to repeat
>indefinately until the user types in 'stop' in the following way:
>
>start :- repeat,
>         write('w00t: '),
>         read_line(Input),
>         (Input=[stop,'.'],stop;
>          write('I\'m terribly sorry. I don\'t understand the meaning
>of that sentence'),nl).
>
>unfortunately it won't work correctly for some reason. am I using
>repeat incorrectly? i got the read_line/1 from
>http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/read_linepl.txt
>
>I appreciate the help!
>
>CB
>
>
>_______________________________________________
>Users-prolog mailing list
>[email protected]
>http://lists.gnu.org/mailman/listinfo/users-prolog
>
>  
>

-- 
Aleksander S. Saidi
Ecole Centrale de Lyon
Département Mathématiques-Informatique
Mél : [email protected]
Tél : 04.72.18.65.30, Fax : 04.78.33.16.15

_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog
Alexandre.Saidi.vcf (text/x-vcard, 436 B)
begin:vcard
fn:A-S Saidi
n:Saidi;Aleksander-Sadegh
org:Ecole Centrale de Lyon;LIRIS-CNRS UMR 5205
adr;quoted-printable:B.P. 163;;36 Ave. Guy de Collongue;Ecully;Rh=C3=B4ne;69134;France
email;internet:[email protected]
title;quoted-printable:Ma=C3=AEtre de Conf=C3=A9rences
tel;quoted-printable;work:(33=C3=A0 04 72 18 65 30
tel;fax:(33) 04 78 33 16 15
x-mozilla-html:TRUE
url:http://www.mi.ec-lyon.fr
version:2.1
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.