I am rather new to KAREL and I was advised by fanuc that a good approach to a more complex karel program is to split the program into separate files. One file is the main program with references to the other project files, one program for routines & functions, and one program for variables. The issue I am having is when I try to create a new karel program for just the variable declaration. When I try to compile a program file with only variable declarations I get a compilation error stating that the program must have a begin statement. If add in a begin statement with no code or just simple variable initializations, it will compile ok; but, when I reference the variable program from another project file with %include K_variables, I get an error that says there is an error with the VAR command in the variable file and that an ID is expected. Should I even be compiling the program for variable declaration? What is the proper way to create and reference a file for just variables?
My variable file is something like:
Program K_Vars
VAR
int1:INTEGER
int2:INTEGER
END K_Vars
The main program would look like this:
Program k_Main
%INCLUDE K_Vars
Begin
do stuff here...
if(int1 = 0) THEN
do more stuff...
ENDIF
END K_Main