🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by sbw@naucse.UUCP Mon, 10 Jul 1989 21:39
Re: return expressions
#43
Author: sbw@naucse.UUCP
Date: Mon, 10 Jul 1989 21:39
44 lines
872 bytes
On Jul 10 at  1:54, Richard Goerwitz writes:
}
} Why doesn't the following program output "go"?
}
} procedure main()
}   write(writeit())
} end
}
} procedure writeit()
}   (return \stopit)
}   return "go"
} end
}
} It looks, however, as though the expression
}
}   return \stopit
}
} is the same as
}
}   fail
}
} at least in this instance, where \stopit fails.
} Why is this so?  Why doesn't the program simply
} print "go"?
}
One thing to keep in mind is that 'return' is a control regime
and not an operator.  While I can see arguments for the behavior
of 'return' going either way, I prefer it the way it is, as I
more often write things like:

	return f(x)

where I want the current function to fail if f(x) fails.

You might see if the control regime

	suspend \stopit

fits with what you're trying to do...

--
	Steve Wampler
	{....!arizona!naucse!sbw}
Re: return expressions
#44
Author: cheyenne@arizona
Date: Tue, 11 Jul 1989 01:37
16 lines
206 bytes


>You might see if the control regime
>
>        suspend \stopit
>
>fits with what you're trying to do...

Or you might want to try:

procedure writeit()
    return \stopit | "go"
end

Cheyenne Wills
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads