Is there an easy way to determine whether a `DiscreteCallback`

is called after the last step of an integration, i.e. just before the integration terminates? I would like to call such a callback using my chosen `condition(u,t,integrator)`

but also when this step is the last.

you can do `other_condition || t == integrator.prob.tspan[2]`

Thanks, Chris!

That’s along the lines of what I’ve tried (and used in the past, if I remember correctly). However, I get

```
julia> using OrdinaryDiffEq, DiffEqCallbacks
julia> ode = ODEProblem((u,p,t) -> -u, 1.0, (0.0, 1.0))
ODEProblem with uType Float64 and tType Float64. In-place: false
timespan: (0.0, 1.0)
u0: 1.0
julia> cb = DiscreteCallback(
(u, t, integrator) -> t == integrator.prob.tspan[2],
(integrator) -> println("Last step"))
DiscreteCallback{var"#3#5",var"#4#6",typeof(DiffEqBase.INITIALIZE_DEFAULT)}(var"#3#5"(), var"#4#6"(), DiffEqBase.INITIALIZE_DEFAULT, Bool[1, 1])
julia> solve(ode, Tsit5(), callback=cb);
ERROR: type ODEIntegrator has no field prob
```

I’m using

- Julia v1.5.1
- DiffEqCallbacks v2.14.1
- OrdinaryDiffEq v5.42.8

`integrator.sol.prob.tspan[2]`

Thanks! I’ve forgotten the `.sol`

. At least I don’t feel completely stupid since we made the same error at first