To help me learn Tikz, I thought it will help, if I can draw each Tikz "object" (the thing that ends with a ";") on its own, then at the end, send them all to tikzpicture to see the whole objects put together. I do this all the time in Mathematica, but I can't get the syntax right with Latex/Tikz.
Let me explain little more, then give a MWE. Suppose I want to draw this picture, which is made of 3 separate objects (the code is from this answer)
\begin{tikzpicture}
\draw (-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle;
\draw[dashed] (-1,0) arc (180:0:1cm and 0.5cm);
\shade[left color=blue!5!white,right color=blue!40!white,opacity=0.3]
(-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle;
\end{tikzpicture}

I'd like to draw each object on its own picture, so I can see how they look like. So I need to assign each object to a variable, to avoid copy/pasting same code. i.e. I'd like to do something like this (which does not work, since syntax is not right) but just to give an idea what I want to do
\documentclass{article}
\usepackage{tikz}
\usepackage{etoolbox}
\newbool{debug} \setbool{debug}{true} %flag for debugging
\begin{document}
%syntax error., Argument of \a has an extra }. }{}
\newcommand{\a}{\draw (-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle}
\newcommand{\b}{\draw[dashed] (-1,0) arc (180:0:1cm and 0.5cm)}
\newcommand{\z}{\shade[left color=blue!5!white,right
color=blue!40!white,opacity=0.3](-1,0)
arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle}
\ifbool{debug}
{
\tikz{\a}
\tikz{\b}
\tikz{\z}
}{}
\begin{tikzpicture} %now put things all together, once get the syntax right
\a;
\b;
\z;
\end{tikzpicture}
\end{document}
The above is what I'd like to do. Now, I do this (copy/paste same code)
\documentclass{article}
\usepackage{tikz}
\usepackage{etoolbox}
\newbool{debug} \setbool{debug}{true} %flag for debugging
\begin{document}
\ifbool{debug}
{
\tikz{\draw (-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle}
\tikz{\draw[dashed] (-1,0) arc (180:0:1cm and 0.5cm)}
\tikz{\shade[left color=blue!5!white,right color=blue!40!white,opacity=0.3]
(-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle}
}{}
\begin{tikzpicture}
\draw (-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle;
\draw[dashed] (-1,0) arc (180:0:1cm and 0.5cm);
\shade[left color=blue!5!white,right color=blue!40!white,opacity=0.3]
(-1,0) arc (180:360:1cm and 0.5cm) -- (0,3) -- cycle;
\end{tikzpicture}
\end{document}

I tried using \def also, but many syntax errors as well. I am newbie.

\gto be1:\let\g1\{– David Carlisle Feb 09 '15 at 14:05\let\a\byou can not use\letwith a brace group, use\newcommand– David Carlisle Feb 09 '15 at 14:08\let\a\{defines\ato be\{You may be new to tikz, but all the usual tex commands have the meaning they had before:-) – David Carlisle Feb 09 '15 at 14:10LaTeX Error: Command \a already defined\ais already defined, call your commands\za\zb\zz– David Carlisle Feb 09 '15 at 15:01