Anonymous user
Icon+Unicon/Intro: Difference between revisions
m
→&fail considered harmful?
Line 688:
=== &fail considered harmful? ===
Okay, &fail is not the evil subversive scourge of programming that the GOTO was once (still is?). However,
In a recent discussion, someone expressed that &fail seemed like an anchor to the notion of languages that return Boolean values. And while that isn't quite how it works the appeal of that idea, especially to people new to the language, makes sense on some gut level. '&fail'
<lang Icon>...
return &fail # &fail fails and return causes the procedure to fail.
Line 702:
Just for completeness:
<lang Icon>...
fail &fail # is a syntax error as fail takes no expression
</lang>
As one can see this is less about the behavior of &fail as it is about the behavior of return and suspend.
'&fail' does have uses as can be seen in this example from [https://www.cs.arizona.edu/icon/progcorn/pc_inl21.htm| The Icon Newsletter's Programming Corner]:
<lang Icon>
# The outcome of a looping expression such as
|