Yes! In fact, that’s what’s wonderful about pointers!
Assuming I’m understanding your situation correctly, I think you’d want Home_Virtual_Switch to be the pointer here. In other words, sometimes it will “point” to one variable, and sometimes another, like this (it’s also common to put a ‘p’ in front of your pointer variable names):
If (X_Axis_Home_Position == Left) then
pHome_Virtual_Switch = &iLeft_Virtual_Limit_Switch;
If (X_Axis_Home_Position == Right) then
pHome_Virtual_Switch = &iRight_Virtual_Limit_Switch;
Check out the section in Form 1700, the PAC Control Users Guide, about “Understanding Pointers” which starts on p. 298. (It’s also the first option in PAC Control under Help > Manuals.)
Also handy, this OptoScript sample strategy which includes a “Pointers” block (top-center of chart). I’ll include a picture below of that block.
Notice when you use pointers, you’ll see some & and * characters in there. The way I remember which one to use is to think of ‘a’ for ‘ampersand’ and ‘address’. As shown in my example above, you want the pointer to point to the ADDRESS (in memory) of your variable (vs. the value stored at that address).
The * means, ‘what this points to.’ I remember this by thinking of an arrow (which points) from the back/end, where it has the feathers (fletchings?) sticking out in the shape of a * if you get what I’m saying here.
So in your code, when you later want to do something with this variable that pHome_Virtual_Switch points to, you do what we call “de-referencing” (get the value that this references) by adding * at the front to say “what this thing points to.”
Hope that all makes sense!