wezelboy Posted June 15, 2007 Share Posted June 15, 2007 Does assigning a return value in a function immediately cause the function to return? -P Quote Link to comment
MullinRJ Posted June 15, 2007 Share Posted June 15, 2007 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 Quote Link to comment
wezelboy Posted June 15, 2007 Author Share Posted June 15, 2007 Thanks. I guess I have to leave the GOTOs in my function. Dijkstra would not be happy with VectorScript ;-) Quote Link to comment
MullinRJ Posted June 16, 2007 Share Posted June 16, 2007 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 Quote Link to comment
Dieter @ DWorks Posted June 16, 2007 Share Posted June 16, 2007 i also don't use goto's because you'll need to be very carefull with them. if you have pages of code, it gets confusing and hard to find where to go. better not use them. Quote Link to comment
Recommended Posts
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.