Fruit flies are trained such that a control odour is presented alone, whereas a trained odour is paired with pulses of electric shock as reinforcement. Across groups, the inter-stimulus interval (ISI) between the onsets of the trained odour and shock is varied. Here, ISI is defined such that for negative ISI values, the trained odour precedes shock; positive ISI values mean that the trained odour follows shock. For each ISI, two fly subgroups are trained with switched roles for two odours (not shown). During the test, each subgroup is given the choice between the two odours; the difference between their preferences is taken as the learning index. Positive learning indices indicate conditioned approach to the trained odour, negative values reflect conditioned avoidance. Very long training ISIs support no significant conditioned behaviour. If the odour shortly precedes or overlaps with shock during training (ISI = −45 s, −15 s or 0 s), it is strongly avoided in the test (punishment learning). If the odour closely follows the shock-offset during training (ISI = 20 s or 40 s), flies approach it in the test (relief learning). *: P<0.05/8 while comparing to zero in a sign test. Sample sizes are N = 8, 24, 34, 47, 24, 35, 12 and 12. Data from [15], with permission from Informa healthcare.