Skip to main content

conditional_branches

Function conditional_branches 

Source
pub fn conditional_branches(name: &str) -> Option<usize>
Expand description

The number of trailing T/F branch arguments of an expl3 conditional, read from the command name’s argspec (the substring after the final :). \tl_if_empty:nTFSome(2), \bool_if:nT/:nFSome(1); None for any name without a :-argspec ending in T/F — a non-conditional expl3 function (\seq_new:N), or a LaTeX2e command with no colon (\@ifpackageloaded). In an expl3 argspec T/F denote only the true/false branch slots, so a trailing T/F run is exactly the branch count.

Deliberately not derived from expl3_slots: this counts the raw trailing run, so a name whose earlier letters make the arity unrecognized (a hypothetical :wTF shape) still reports its branches — the conditional layout keys on the branches alone and must not regress when the full arity model bows out.