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: 24
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: 24
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

-
» You should never call 911 if.........
» Roll Call
» Roll Call When You Are Needed
» Call Girl Melayu-Halena
» Call of duty lobby hosts here

Permissions in this forum:You cannot reply to topics in this forum
Jubecron Forum ::  :: -