View Single Post
 
Old 12-14-2015, 10:55 PM
paik1002 paik1002 is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Dec 2015
Posts: 63
paik1002 is on a distinguished road
Default Function or subroutine with counting memory

I'd like a subroutine/function to have memory, such that it keeps track of the number of times it has been called. The count can be passed back to the parent subroutine.

Here is roughtly what I would like to do(pseudo-code):

Public Function memory() as integer
count++
count = memory
End Sub

Sub main()
current_count = memory() ; current_count = 1
current_count = memory() ; current_count = 2
current_count = memory() ; current_count = 3
End Sub


Can it be done?
Reply With Quote