Return Statement

The return statement causes execution to leave the current subroutine and resume at the point in the code immediately after where the subroutine was called. It's mainly intended to be used with gosub statement.
Return statement suffers from the same sort of readability problems as the GOTO statement and like goto, the use of return statement is generally discouraged.

Here is a simple example :

sub procedure Proc1()
dim error as byte
  ... ' we're doing something here
  if error = TRUE then
    return
  end if
  ... ' some code, which won't be executed if error is true
end sub
  Note : Return statements performs the same as exit statement except in functions. If breaking out of a function with return statement, return value will not be specified. In such cases exit statement should be used.
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code