4.prolog 与visual prolog.ppt

分支与循环 * student(1,mary,90.2). student(2,stone,95.5). student(3,peter,96.4). print :- student(Number, Name, Score), write(Number, Name, Score), nl, Number = 3. 计数循环 * student(1,mary,90.2). student(2,stone,95.5). student(3,peter,96.4). print :- student(Number, Name, Score), write(Number, Name, Score), nl, fail. print. do循环 9 动态数据库 asserta(fact) Insert a fact at the beginning of the matched internal facts section. assertz (fact) insert a Fact at the end of the matched internal facts section. retract (fact) Remove a Fact from the matched internal facts section. * 例子1 * * * * 例子 * * 2.6

文档评论(0)

1亿VIP精品文档

相关文档