function next input Integer x; output Integer y; algorithm y := 1 - x; end next; class System Integer x; initial equation x = 0; equation when sample(0, 1) then x = next(pre(x)); end when; end System;