From the Zig language documentation, I came across a concept called Inline Switch Prongs. However, there is no explanation for the word prong(s). I was not able to find any explanation from other resources in the internet as well. Can someone explain what it means?
What does "prong" mean in the context of Zig language?
99 Views Asked by quettabit At
2
There are 2 best solutions below
0
On
I took prong to be derived from the => symbol in Zig's switch, which looks like a fork (the utensil) and forks have prongs.
I think it's an analogy to physical switches, particularly multiple position switches which have an input pin, and several output pins. For example, power in, and two power out pins based on the switch position, or three positions with one being "off" with no connection to either pin.
Usually "prong" is used for a plug, but components like switches can be plugged into circuit boards, so the pins can (rarely, it seems) also be called "prongs".
So the positions of a toggle switch can be matched with prongs. A
switchstatement (whether zig, C, or some other language) is associated with differentcasestatements, so looks like someone decided to make an analogy. I've never seen this used anywhere else.