我的目标,程序才能打印出true
或false
返回前menu2/0
park(_,blue,basketball_court).
menu2 :-
nl,write('Select operation:'),nl,
write('1. Check which parking area available to park right now.'),nl,
write('2. Check whether a particular parking area is legal to park.'),nl,
write('3. End program.'),nl,
read(X),nl,choice(X).
choice(2):-
write('Enter your identity:'),nl,
read(C),
write('Enter sticker type:'),nl,
read(D),
write('Enter parking area:'),nl,
read(E),
park(C,D,E),
menu2.
下面是我得到:
menu2.
Select operation:
1. Check which parking area available to park right now.
2. Check whether a particular parking area is legal to park.
3. End program.
2
Enter your identity:
staff
Enter sticker type:
blue
Enter parking area:
basketball_court
Select operation:
1. Check which parking area available to park right now.
2. Check whether a particular parking area is legal to park.
3. End program.
之后basketball_court
,我希望True
出现。 此外,在另一种情况下,即使“假”的出现,如何使之循环回menu2/0
?