On Tue, 2013-11-05 at 06:34 -0800, 2aq9j93b7s wrote:
> thank you for the replies I appreciate them
> 
> Unfortunately you are missing the point of the post! I have an uncommeneted
> line of code that is not and cannot be executed
> 
> bruce
> "Now do you see why that last line is not executed."
> My point exactly but when is it executed if at all?
> 
To put it plainly, it will never be executed because it is after the
quite valid Return command.


Private $aChar as String="a"

Private Sub DoNothing()

  Dim bChar As String= "b"

  Return

  $aChar=bCar

' plus a whole bunch of further code that will
' never  be executed because this Sub has 
' already Returned, like
  Format(Now(),"yy-mm-dd")
  Now()
' etc  


End


Public Sub Main()

  DoNothing

  Print $aChar

End


What you appear to have fallen for is the old
putting a comment in the middle of a multiline
command. As soon as you do that you have terminated the
command and the "lines of code" after that are never executed
because you have already got a valid Return command.

Secondly, don't forget that all Gambas functions can be 
used as subs. So, the things that look like dangling functions
in the code above aren't. They are functions used as subs.

Bruce





------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to