I have this problem from Conway Complex variable book, and I have my own solution. I just want to know if my example is correct.
Section 4.3 Problem 2. Give an example to show that $G$ must be assumed to be connected in Theorem 3.7.
Theorem 3.7: Let $G$ be a connected open set and let $f: G \to \mathbb{C}$ be an analytic function. Then, the following are equivalent statements:
(a) $f \equiv 0$
(b) there is a point $a \in G$ such that $f^{(n)}(a) = 0$ for each $n \geq 0$
(c) $\{z \in G: f(z) = 0\}$ has a limit point in $G$.
My example:
Let $G = (-\infty,0)\cup(0,\infty)$. Clearly $G$ is open and not connected. Consider the function $f: G \to \mathbb{C}$ as
$ f(z) = \begin{cases} -1, & \mbox{ if } z \in (-\infty,0)\\ 0, & \mbox { if } z \in (0,\infty). \end{cases} $
Then $f'(z) = 0, \forall z \in G$ and $f$ is differentiable with a continuous derivative. Hence, $f$ is analytic in $G$. Pick $a \in (0,\infty)$, then $a \in G$ and $f^{(n)}(a) = 0, \forall n \geq 0$, but $f \neq 0$. Hence, (b) $\nRightarrow$ (a) and the three statements are not equivalent if $G$ is not connected.
Your example is not appropriate, since your set $G$ is not an open subset of $\mathbb C$.
You can take $G=\{z\in\mathbb{C}\,|\,\operatorname{Re}z\neq0\}$ and define$$\begin{array}{rccc}f\colon&G&\longrightarrow&\mathbb C\\&z&\mapsto&\begin{cases}1&\text{ if }\operatorname{Re}z>0\\0&\text{ if }\operatorname{Re}z<0.\end{cases}\end{array}$$