In c language i have something like :
if(cond1)
{}
else if(cond2)
{}
else
{}
how is this possible in Prolog?
( If1 -> Then1
; If2 -> Then2
; ...
; otherwise
).
Note that if-then-else is only necessary if you cannot express the different conditions by pattern matching in different clauses. Everything that can be expressed by pattern matching should be expressed by pattern matching, as this typically leads to more general and also more efficient code.