Toggle in the control domain is easy.

Toggle in the signal domain... here are a couple of ways.

toggleff~.pd -- probably faster, but it may overflow after a long time (hours).

toggleff-forever~.pd -- will not overflow, but uses fexpr~ so it might be slower.

Both define a signal trigger as a crossing from <= 0 to > 0.

Was first looking into this in Max (which doesn't have a native one), then wondered what it would take in Pd. Not that much but it's enough that you don't want to build it out by hand every time.

hjh