Posts: 4,703
Threads: 222
Joined: Apr 2022
Reputation:
322
Sorry for the wait, needed lunch.
Hey this works just fine!
Code: (Select All)
f = f1
f = f2
GoTo endF
endF:
End
Function f1
Print "F1"
GoTo endF
endF:
End Function
Function f2
Print "F2"
GoTo endF
endF:
End Function
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 4,703
Threads: 222
Joined: Apr 2022
Reputation:
322
So,
Your template might look like this for any function start:
Code: (Select All)
Function f1
If debug Then Print "Entering f1"
GoTo endF
endF:
If debug Then Print "Exiting f1"
End Function
plug in with copy/paste and modify names, for example:
Code: (Select All)
Dim Shared As Long debug
Print "Hello from main code section."
debug = 0 ' test with 0 and 1 or -1
f = f1
f = f2
GoTo endF
endF:
Print "The end"
End
Function f1
If debug Then Print "Entering f1"
GoTo endF
endF:
If debug Then Print "Exiting f1"
End Function
Function f2
If debug Then Print "Entering f2"
GoTo endF
endF:
If debug Then Print "Exiting f2"
End Function
or use one of the other DIYD suggestions.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 520
Threads: 54
Joined: Jul 2022
Reputation:
48
Hi
1. I remember that someone uses to print on the console to have debug output on another window aside that of the running program.
I sometimes used this way.
2. in More cases I used to print before and after the block of code that doesn't work as aspected, and this way fixes the 80-90% of bugs.
After print the variables values, the program stops its flow for a SLEEP or a _DELAY.
3. I rarely print variables variations into a file for analizing it in a second time.
and if I think that there is a logic bug, I allow the flow of code to drive me to the bug.
PS:
Option _Explicit & Option _ExplicitArray save so much time! I often mistype the name of variables! I more less declare a wrong data type among MAIN, SUB & FUNCTION parameters, in the SUB & FUNCTION with SHARED. (i.e. integer vs single vs long)
My two cents
PPS:
Knowing in what SUB/FUNCTION we are give us poor informations...I suggest you to follow the flow on the paper or using the Debug F7/F8 to execute step by step the code.