小编ano*_*tat的帖子

Prolog 错误捕获

鉴于:

fruitid('Apple', 'Granny Smith', 1).
fruitid('Pear', 'Bartlett', 2).
Run Code Online (Sandbox Code Playgroud)

如果我有条款

type_of_fruit(ID):-
       fruitid(Fruit, _, ID), write(Fruit).
Run Code Online (Sandbox Code Playgroud)

我怎样才能实现一种方法来捕捉错误的输入?

例如

fruitid(5).
Run Code Online (Sandbox Code Playgroud)

谢谢。

作为

prolog

3
推荐指数
1
解决办法
3563
查看次数

标签 统计

prolog ×1