Mombu the Programming Forum

Mombu the Programming Forum > Programming > Programming languages > If-then-else
REGISTER NOW! Mark Forums Read




Reply
 
Thread Tools Display Modes
1 24th March 15:01
alley
Miembro
Mombu User
 
Join Date: Mar 2008
Location: Malta
Posts: 1
alley is on a distinguished road
Default If-then-else



Hello,

Can someone please explain to me how the if-then-else in Prolog works?

I'm trying this but I must be doing something wrong:

found(X,.(X,Y)) :- true, write(X), ! ; found('Not Found').
found(X,.(Y,Z)) :- found(X,Z).

If X is found in the list Y, it will print X, else it should print 'Not Found'.

What am I doing wrong?
alley is offline   Reply With Quote
SPONSORED LINKS BY GOOGLE

 


Reply


Thread Tools
Display Modes







Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
Also visit Ogoun the Usenet Archive
666