Answer the question
In order to leave comments, you need to log in
How to determine the type of a variable?
program Color;
uses crt;
const
ColorCount = 16;
var
AllColors: array [1..ColorCount] of word =
(
Black, Blue, Green, Cyan,
Red, Magenta, Brown, LightGray,
DarkGray, LightBlue, LightGreen, LightCyan,
LightRed, LightMagenta, Yellow, White
);
;
procedure makeline(line, fgcolor: integer);
MakeLine(i, Allcolors[i mod ColorCount + 1]);
Answer the question
In order to leave comments, you need to log in
Because not explicit type conversion works. You can also use Integer if you need float or double. Or type char if a string is required.
This is possible because the range of word values is within the range of Integer values. A character can also be a string.
Allcolors[i] is the i (th) element of the array. In this case, an element of type word. Or rather - the color for the console.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question