There are different packages out there to add answers to exercises to a document, like answers and exercise, however they're all a bit overkill, e.g. they re-format and re-number the list of exercises in my document.
What I want to achieve is juist this: I have a list of exercises, which are formatted in a standard enumerate-environment, and I want to put the solutions just underneath, but in the beginning of my document I want to be able to define some kind of 'flag'. If the flag is 'on', then the document should print out my lecture notes with solutions, if it's 'off', it should just skip the solutions and print out the document as if the solutions were never there (so also not leave blank space or something similar.
Ideally, something like this:
List of exercises:
\begin{enumerate}
\item 2+2
\begin{solution}
4
\end{solution}
\item 3-1
\begin{solution}
2
\end{solution}
\item 5+2
\begin{solution}
7
\end{solution}
\end{enumerate}
If the flag is off, all solutions should be downright skipped.
Is there a way to do this, preferably as simple as possible?