[Tex/LaTex] Variables with Input from Separate File

input

I just started learning Latex for work but I'm having trouble with a code I'm writing. I'm trying to create a file that will take variables from another file and print them out with their assigned values in different settings. I have another file that has all the variables stored and will later input variables from matlab there.

This file is the one with my variables:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{calc}
\input xintexpr.sty\relax

\title{Example of Variable Input}
\author{Cordelia David}
\date{April 2019}

\newcommand\Strawberries{34}
\newcommand\Apples{14}
\newcommand\Grapes{431}
\newcommand\Pears{56}
\newcommand\Tomatoes{42}
\newcommand\TotalFruit{\xintexpr \Strawberries + \Apples + \Grapes + \Pears + \Tomatoes \relax}

\begin{document}

\maketitle

Strawberries = \Strawberries\

Apples = \Apples\

Grapes = \Grapes\

Pears = \Pears\

Tomatoes = \Tomatoes\

Total of all Fruit = \TotalFruit\

\end{document}


Which prints out mostly correctly, though I'm unsure why there's an exclamaton mark in front of the number for Total of All Fruits when compiled.

This is the file that calls that file:

\documentclass{article} \usepackage[utf8]{inputenc}

\title{Example of Variable Input} \author{Cordelia David} \date{April 2019} \input{Variables.tex} \begin{document}

\maketitle

\section{Introduction}

We had \Strawberries\ Strawberries for this year's harvest. Probably not enough.

\end{document}


The problem I'm having is it will only compile the variables file, and anything I write in the main text won't get printed. Why is this? How do I fix this?

\documentclass{article} \usepackage[utf8]{inputenc}

\title{Example of Variable Input}
\author{Cordelia David} \date{April 2019}
\input{variables.tex}

\begin{document}

\maketitle

\section{Introduction}

We had \Strawberries\ Strawberries for this year's harvest. Probably not enough.

\end{document}


with variables.tex :

\newcommand\Strawberries{34}
\newcommand\Apples{14}
\newcommand\Grapes{431}
\newcommand\Pears{56}
\newcommand\Tomatoes{42}
\newcommand\TotalFruit{\the\numexpr \Strawberries + \Apples + \Grapes + \Pears + \Tomatoes \relax}