Reply to post: Re: What's Wrong With a Loop?

Microsoft debuts Bosque – a new programming language with no loops, inspired by TypeScript

thosrtanner

Re: What's Wrong With a Loop?

It's worse than that. Not only can you have multiple entry points, you can pass the possible exit points to the function

That is to say you can do

CALL RANK ( N, *8, *9 )

WRITE (*,*) 'OK - Normal Return'

STOP

8 WRITE (*,*) 'Minor - 1st alternate return'

STOP

9 WRITE (*,*) 'Major - 2nd alternate return'

END

SUBROUTINE RANK (N, *, *)

IF ( N .EQ. 0 ) RETURN

IF ( N .EQ. 1 ) RETURN 1

RETURN 2

END

I'm pretty sure this is what the 'no multiple returns from a function' rule refers to. IMHO it makes absolutely no sense except for fortran

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon