# abort the whole notebook conditionally

The whole notebook is one task, but due to Memoryconstrianed the notebook may abort some steps in the middle. As long as this happens, I would like to abort the whole subsequent code, too. Is there any command can do this?

• What about converting your cells to functions and composing your procedure with them instead of evaluating notebook. It will make your life easier – Kuba Jan 10 '18 at 20:06
• This question should answer yours: 98882 but as you can see it is rather hairy due to the fact that cells are queued in a process that can be controlled by a user in a very minimal factor. – Kuba Jan 10 '18 at 20:11
• I presume you want to abort without quitting the Kernel? (Otherwise, having Quit[] as the last argument of MemoryConstrained would do the trick.) – mmeent Jan 11 '18 at 8:10
• @mmeent you are right, quit[] is exactly what I need. but Memoryconstrained can only work on single expr or input each time, I would like to constrain all the programme i.e. the memory of all the evaluation in the whole notebook should constrain within a constant memory number. since each expr may not exceed memory but the sum of them exceeds. is there some command works on MemoryInUse to confine the memory of the evaluation of notebook ? Thanks! – Ivy Gao Jan 11 '18 at 18:11