When I searched the web, I found this, but it's not working in Turbo Prolog, it shows a syntax error in "-" symbol of "->". How to if-else in Turbo Prolog? I'm trying to:
replacer(Str,Victim,Killer,Res):-
str_len(Str,0) ->;
frontchar(Str,CurChar,Tail),
CurChar=Victim -> concat(Res,Killer,Out), replacer(Tail,Victim,Killer,Out);
concat(Res,CurChar,Out), replacer(Tail,Victim,Killer,Out)
Aucun commentaire:
Enregistrer un commentaire