Break::nofunc Continue::nofunc Return::nofunc

Details

  • This message is generated when the optional second argument in Break, Continue, or Return does not match an enclosing function call.
  • The second argument in Break, Continue, or Return is a label that specifies the enclosing function or loop that will be affected. If this label is omitted, the affected function or loop is determined using built-in heuristics.
  • Off[message] switches off the message; On[message] switches it on. For example: Off[Break::nofunc].

Examples

Basic Examples  (2)

Return is used with two arguments and there are no enclosing functions:

This shows a typical use of Return with two arguments. The second argument is used here to specify that the return should be from the enclosing Module:

Without the second argument in Return, the default is to return from the enclosing Do loop, so the return value of the function will be different:

This shows an incorrect use of the second argument in Return. The function f does not enclose the Return expression and so cannot be used as a return destination.

Clear the definition of f: