To make the code easier for students and less prone to mistakes, we want to use a single custom defined function for both model and gq blocks. For example, we have some function we defined within stan that has ˜20-30 lines of code. These lines are are exactly the same for both gq and model blocks but 1 or 2 rows are actually different.
Is there a way to know within a function whether its being read from gq or model blocks?
Any other ideas how to not use copy-paste or simple if-then coding to work with a single function with slight changes between model and gq blocks?
Hope the question is clear enough.
Thank you all,