if else if else clause in prolog similar to C/C++

前端 未结 5 784
说谎
说谎 2021-01-18 14:53

In c language i have something like :

if(cond1)
{}
else if(cond2)
{}
else
{}

how is this possible in Prolog?

5条回答
  •  一生所求
    2021-01-18 14:58

    (cond1 ->
        consequent1
    ; cond2 ->
        consequent2
    ;
        alternative
    )
    

    For the record, this is called a conditional.

提交回复
热议问题