# Error in creating a node and its label

Good day. I have problem on creating a node and its name. Here is the code number 1 and 2.

\documentclass[a4paper, 12pt]{article}
% Preamble

% Packages used for input and output display.
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

% package used for images and colors.
\usepackage{graphicx}
\usepackage{xcolor}

% Page layout.
\usepackage[a4paper,margin=2cm]{geometry}
% Package used for diagram.
\usepackage{tikz}
% beginning document.
\begin{document}

% Steps 1.
% 1. create  a node.
% 2.
%
\begin{tikzpicture}

\node{root}             % code 1.
child{node{Arrows}}  % This command works.

\node[root]{Data}   %  code 2. does not work
;

\end{tikzpicture}

\end{document}


In the above code 1 works while code 2 does not work.

Your code as is doesn't work simply because you forgotten to end the first \node instruction with a semicolon.

But even adding that missing semicolon your second node doesn't work because you haven't defined a style named root. You have \node[root]{Data};. Here root is a style for the node, because it's in square brackets, while Data is the content of the node, in curly braces.

\documentclass{article}
\usepackage{tikz} % loads xcolor and graphicx
\begin{document}
\begin{tikzpicture}[root/.style={}] % defined empty root style

\node{groot}             % code 1.