Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to write a function that delays the evaluation of a function (say) $5$ seconds after I hit Shift+Return. Is this possible?

share|improve this question
The tag is wrong. I'd like to use the tag clock but it is new, and I'm not allowed to create new tags. – zab Apr 28 '14 at 15:38
Related: (473), (1565) – Mr.Wizard Apr 28 '14 at 19:25

Use the Pause function:

SetAttributes[delayedFunction, {HoldFirst}];
delayedFunction[function_] := (Pause[5]; function);
share|improve this answer
More useful if defined as delayedFunction[function_, dt_] := (Pause[dt]; function) – m_goldberg Apr 28 '14 at 19:35

An alternative is to use the built in function, RunScheduledTask

RunScheduledTask[z = 7, {5}]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.