# How to stop the process of \int_step_inline in LaTeX3?

Here is a MWE:

\documentclass{article}

\begin{document}
\ExplSyntaxOn
\int_step_inline:nn { 5 }
{
#1
\int_compare:nNnT {#1} > {3}
{
% I want to stop for this case
}
}
\ExplSyntaxOff
\end{document}


I want to stop the process of \int_step_inline or some similar functions on some particular condition. I know there is break of continue in Python. Is there any similar functions in LaTeX3 that do the same things?

• I guess I'm wondering why you'd want to do this - the step function is for the case where you know you want to use every value in a range. Feb 16 at 7:32

Although it's not currently documented, one can use the generic \prg_break: to terminate these constructs early:

\ExplSyntaxOn
\int_step_inline:nn { 100 }
{
\int_compare:nNnT {#1} > { 50 }
{ \prg_break: }
\message { #1 }
}
\stop

• I check it in interface3 and I saw \prg_break is used with \prg_break_point:, but what about the case here?
– xdyy
Feb 16 at 8:28
• @xdyy \prg_break_point: provides a generic mechanism to implement mappings and similar with a 'way out' using \prg_break:. It's therefore used in the implementation of \int_step_inline:nn and similar functions. Like I said, that's not documented - I guess I will need to raise with the team. Feb 16 at 8:30
• I wonder what's the functions of \message and \stop here?
– xdyy
Feb 16 at 8:37
• @xdyy They are for the demo: \message gets TeX to write to the terminal and log, so we don't have to worry about typesetting anything to see the result. \stop is a LaTeX command that just stops the run - useful in demos or debugging. Feb 16 at 8:39