You can call a function inside a procedure. I think (although I don't advise doing it) you can even write a function inside a procedure. Can you show us the code that doesn't work? Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
I'm doing this program about graphing and I need to be able to read the functions from a user input... This is a little part of the program, and it's where I call the raised function it makes an error...
procedure multi(start:integer;slut:integer);
var
r:integer;
answ:real;
begin
for r:=start to slut do
begin
if (func[r]=#42) then
begin
if (func[r+1]=#120) then
begin
if (func[r+2]=#94) then
answ:=raised(r+2,0);
end;
I think the request (made in a previous post: thread102-468045) is a bit ambiguous. What I think Matilde is asking is not to call a function (i.e. a routine with a prototype like
Code:
function myfunction:Boolean
) but actually is defining the term "function" to mean "a mathematical operation" that the user can enter e.g. x^2/3 or 2x^2+6. I had a go at answering before, but some other views would be welcome as I don't think my answer was satisfactory! Clive
I decided not to do the way you suggested because there is a infinite amount of different functions and I want the program to be as user friendly as possible... So I kept on doing the input thing. So now i'm doing a program first to read the function that the user inputs. The best way I could find was to build it up by functions and procedures, but in order to make this work I have to call functions inside procedures and the other way... I don't know if you have any other suggestions or some way that I can solve the error problem...?
Can you step into raised() to see what the error is? Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
Where is raised()? Is it in a compiled unit? Is it possible that real is not a valid data type for the returned value from raised()? Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
Try doing a Find in Files and choose a top level directory and see if you can find it. What do you know about this Raised function and why are you using it? Did you see it in some help file?
Yes it's already declared... I almost bearly started on Delphi programming so I'm not that much in to it, it might be better to put it in to a class... I just can't figure out this problem.!
Can you show us the declaration in the interface section, the function declaration in the implementation section, and tell us what error message the compiler is generating? Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.