Synthetic genetic circuits are programmed in living cells to perform predetermined cellular functions. However, designing higher-order genetic circuits for sophisticated cellular activities remains a substantial challenge. Here we program a genetic circuit that executes Pavlovian-like conditioning, an archetypical sequential-logic function, in Escherichia coli. The circuit design is first specified by the subfunctions that are necessary for the single simultaneous conditioning, and is further genetically implemented using four function modules. During this process, quantitative analysis is applied to the optimization of the modules and fine-tuning of the interconnections. Analogous to classical Pavlovian conditioning, the resultant circuit ...