Jubecron Forum

The JUBECRON forum - Jamaican Chat, Dating, Games, Anime, and just meeting people.
 
HomePortalFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

 Introduction to Function Call and Parameter Passing in Prolog

View previous topic View next topic Go down 
AuthorMessage
Beezle
Elite Member
Elite Member


Female
Number of posts : 547
Age : 26
Mood :
Points : 253
Registration date : 2008-03-02

Character sheet
Weapon: Chakrams
Class: Ninja Ninja
HP:
50/50  (50/50)

PostSubject: Introduction to Function Call and Parameter Passing in Prolog   Tue Oct 19, 2010 7:44 pm

Question:
Send value for salary to a function called comp_net/2. The second value represents the results.


% Author:
% Date: 9/28/2010

calc:-write('Input Salary: '), nl, read(Sal), comp_net(Sal, Net), write('Net: '), write(Net).

comp_net(Sal, Net):-Gct is Sal * 0.15, Net is Sal - Gct.

Question:
Use another function called comp/2 to compare two numbers and output which is smaller.


comp(A, B):-A < B -> write(A) , write(' is smaller'); write(B) , write(' is smaller').
Back to top Go down
View user profile
Beezle
Elite Member
Elite Member


Female
Number of posts : 547
Age : 26
Mood :
Points : 253
Registration date : 2008-03-02

Character sheet
Weapon: Chakrams
Class: Ninja Ninja
HP:
50/50  (50/50)

PostSubject: Re: Introduction to Function Call and Parameter Passing in Prolog   Tue Oct 19, 2010 8:25 pm

The '/2' means that there should be two variables in the header.
Back to top Go down
View user profile
 
Introduction to Function Call and Parameter Passing in Prolog
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» SCRAPBOOK SAVVY DT CALL
» Stamp Illustrator Call
» Design Team Call at Jeans Art Dolls
» Kaisercraft DT call!
» Hi I'm not really sure what an ideal introduction topic title should be so I got nervous and now I don't know how to stop writing..

Permissions in this forum:You cannot reply to topics in this forum
Jubecron Forum :: School :: Schools (General)-
Jump to: