What helped me to grasp the principles of switched-coil converters was an animated, interactive simulator.
Below is a link to my conceptualization of a simple buck-boost.
Click it to open the falstad.com/circuit website, load my schematic, and run it on your computer. (Click Allow to load the Java applet.)
https://tinyurl.com/bwfxjou
Watch the scope traces. The coil is at the center of action.
You can change the load resistance as desired. Right-click on it and select Edit to bring up a window.
The power supply is 3V. You can change it to 24 V.
It lacks regulation. That requires additional circuitry.
Clock pulses are driving the switch.
You can choose to drive it yourself by clicking the switch in the middle.
Click the switch at left to start the switch-On cycle.
Let up on the switch to see the switch-Off cycle.
Continue at a pace that keeps 5V on the load at right.
You'll find that for a given supply V, there is a particular duty cycle that goes with it, to obtain 5V output at the load.