Jump to content
Developer Wiki and Function Reference Links ×

Quick question on functions


Recommended Posts

No, you can have statements after the function's return value is assigned, or have several exit points in the function where an appropriate value is assigned.

eg. :

function abc(X, Y :Real) :Integer;
Begin
abc := 0;
if X>Y then abc := 1
else if Y>X then abc := 2
else if (X<1) or (Y<0) then abc := -1;
End;

Raymond

Link to comment

In all the years I've programmed with Pascal, I've never had to use a GOTO. If you learned to program with BASIC it may be ingrained in the way you think about programming, but it's definitely not necessary. If you want to lose the GOTO's, post more and I or someone will help you kick the habit. If they don't bother you, we won't tell Dijkstra. ;-)

Raymond

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...