I create physics exercises and at the end of each exercise I give short numerical answers which I want to be on the right, to maintain the numbering of the questions and to be bold.
Τhe important thing is that I want to be able to hide it when I want (in case of examinations). Τo do this I use the very useful tips from my previous question
Comment out lines without using % and comment enviroment
I've got the code.
\newif\ifprolog
\long\def\startprolog#1\stopprolog{%
\ifprolog
\par
\begingroup
\let\\\par
\color{red}\small #1
\par\medskip
\endgroup
\fi}
\prologtrue
and I try to create answers to every exercise with the command to appear and disappear by choosing \answerstrue
\documentclass[b5paper,10pt]{book}
\usepackage[inline]{enumitem}
\newtheorem{exercise}{}[chapter]%[chapter] %{Άσκηση}%[numberby]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%
\newif\ifanswers
\long\def\startanswers #1 \stopanswers{%
\ifanswers
\par
\begingroup
\let \\ \par
\begin{flushright}
[\textbf{\small Answers: \, #1}]
\end{flushright}
\par\medskip
\endgroup
\fi}
\answerstrue % is to show or not the answers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{physics}
\begin{exercise}
here is the exercise ...
Αnswer the questions:
\begin{enumerate}
\item quation 1
\item quation 2
\item quation 3
\item quation 4
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%
\startanswers
\begin{enumerate*}
\item % here there is no numerical answer because the question was theoretical
\item $\sqrt{2}$
\item $5/3$
\item $\frac{1}{2}$
\end{enumerate*}
\stopanswers
%%%%%%%%%%%%%%%%%%%%%
\end{exercise}
\end{document}
Τhe problem is when I do not import something after \item (because the question was theoretical)
\startanswers
\begin{enumerate*}
\item % here there is no numerical answer because the question was theoretical
i take error when a run the .tex file.
My quastion: Ηow can I rid of the error or if you have a more practical idea to get the answers out of a printable file

