Suppose you have a document where you want to mention how many sections there are in the beginning. For example, something like this:
\documentclass{article}
\begin{document}
Abstract\\There are ... sections in this document.
\section{Section 1}
\section{Section 2}
\section{Section 3}
\end{document}
Here ... would be a macro (or something else) that says that there are 3 sections.
I, unfortunately, could not find a way to have that macro evaluated at the end (where it reports 3).
In this example, I want to know the number of sections in the end. There might be a solution using counters (in some way), but I am really looking for a solution where I can have some influence the order of evaluation of the macros.