I noticed that variables can have "Save value to profile" AND "Retrieve saved value" BOTH ticked at the same time.
How does that work?
If both options are chosen, the value would theoretically be retrieved, then that same value that was just retrieved would be immediately saved to the profile again. There is no real point to doing so (assuming you're not performing operations on that value, which the "Set a Text Value" action, specifically, can).
So, would you set up the values in a same-named variable in another command and this one would (and this is another question) save and/or retrieve the values??? (And here's the other question) How would this variable know if it's supposed to save or retrieve?
What? A variable can't "know" anything. It's a piece of data stored in memory, it doesn't do anything by itself.
Are you confusing the action that sets the variable (I.E. writes the data into memory) with the actual variable (I.E. the data stored in memory)?
Saving a value to a profile serializes
a copy of that data and stores it in the profile database (technically it caches it in memory so it can be saved later, as mentioned, but the principle is the same). At that point, there is the actual variable that exists in memory, and copy of the data stored in that variable in the database.
Those are two separate entities; making a change to the variable without again saving it to the profile will result in different data existing in memory, and in the database.
E.G. if you set a text variable to "A", and save that to the profile, your variable will contain "A", and the copy stored in the database will contain "A".
If you then set that same text variable to "B", without saving it to the profile, you variable will contain "B", while the copy in the database will still contain "A".
If you retrieve the data from the database at that point, your variable will be set to "A", as that was the value stored in the database.
do you have to execute the command the variable is in to get it to save/retrieve?
Yes.