I know that if a topological space $X$ is connected, then the only subsets of $X$ that are both open and closed are $\varnothing$ and $X$.
However, if I take for example the interval $I = [0,1]$ with the discrete topology, then $[0,1/2)$ is open so that the complement $[1/2,1]$ is closed in $I$. However, since we are working with the discrete topology, $[1/2,1]$ is open in $I$. However, since $[0,1]$ is connected, the only sets that are both open and closed are $[0,1]$ and $\varnothing$.
Could anyone point out the flaw in my thoughts?