Consider the following code (taken from question 158857):
g = 9.81;
eqs = {x1''[t] + g == 0, x2''[t] + g == 0};
ci = {x1[0] == 1, x2[0] == 2, x1'[0] == 0, x2'[0] == 0};
events := {WhenEvent[x1[t] == 0, x1'[t] -> -x1'[t]],
WhenEvent[x2[t] == x1[t], v1 = x1'[t]; x1'[t] -> x2'[t]],
WhenEvent[x2[t] == x1[t], (* -> *) 1; (* <- *) x2'[t] -> v1]}
sol = NDSolveValue[eqs~Join~ci~Join~events, {x1, x2}, {t, 0, 5}]
Plot[{sol[[1]][t], sol[[2]][t]}, {t, 0, 5}]
It returns
The first WhenEvent accounts for the bouncing on the ground ($y=0$) while the other two aims at exchanging the derivatives.
Now if I remove the 1; in the last WhenEvent, I get the following error
NDSolveValue::nlnum1: The function value {v1} is not a list of numbers with dimensions {1} when the arguments are {0.790166,0.9375,1.10736,0.9375,-7.75153}.
Why is only working if I add something before x1'[t] -> x2'[t] ?
I tried on MMA 11.0 and 10.3.


Module[{}, x2'[t] -> v1]makes it work as well. Odd. – george2079 Oct 31 '17 at 18:25WhenEvent:{x1'[t], x2'[t]} -> {x2'[t], x1'[t]}]( not really answering the question though ) – george2079 Oct 31 '17 at 18:28Printstatement into the firstx2[t]==x1[t]event, that is printed after the error message (so in fact,v1hasn't been defined yet). – Chris K Oct 31 '17 at 21:05"Priority"option ofWhenEvent, but that didn't seem to help either. – Chris K Nov 01 '17 at 00:49