Hi there,
I want to ask a small question about how short-circuiting works for Boolean operators within RTMB-wrapped functions. My understanding is that in regular R, the "&" (and) and "|" (or) operators do not short circuit (probably because they are vectorized?) but if you use "&&" or "||", those are (although you lose the vectorization. When you are comparing objects of length 1 with each other it is technically optimal to use these because it short-circuits and doesn't always need to check the second condition, if I understand correctly. However, I also realize that in some other languages, there is only one set of and/or operators and they short-circuit automatically.
I want to know if it makes a difference to use "&" versus "&&" within the R code of a function to be passed into RTMB::MakeADFun. Obviously this would only be relevant for cases when the two logicals being passed to "&" (or "&&") have length one and do not depend on any of the model parameters (but instead might depend on values of the data or the index of a loop or something). I realize it probably makes a minimal difference either way, but should I bother using "&&" or will RTMB convert it to something equivalent anyways?
Thank you for any input you might have!