Knowing facts personally is very important. Obviously the type of facts you're describing here are usually not useful. However if I had to look up the syntax for a while loop that would be horrible! Imagine if I had to look up what looping structures were available! Your personally known set of facts is a huge factor in how effective you can be in any given endeavor
Very true. Being able to do routine things quickly and accurately without much mental effort reduces cognitive load that makes capacity available for tackling larger more complex problems. The other thing to note is that we are not only limited in size of what we can hold in our head, but also time. Not having to look up an easily found answer means that we can get to a solution before running out of time.
If you use the loops in this particular language often, then you memorize it just by practice along otherwise there is nothing wrong to look up a syntax for a language you use once in a blue moon (f.s.)
This is a really great point!! It's not only about knowing facts, it's also a bit more meta and it's knowing what to know and what's worth jolting down somewhere
If you are coding in 5 different languages at work, then I am afraid you will have 5 cheatsheets open in front on you, no matter how good your memory is. Cheatsheet access can be faster than human memory access, especially for the infrequently used stuff.