![]() ![]() As you can see, you can define multiple variables in one line if they are of the same type. As with all Delphi statements, a terminates the line. Notice that the variable definitions are indented - this makes the code easier to read - indicating that they are part of the var block.Įach variable starts with the name you choose, followed by a : and then the variable type. We'll show later exactly where this var section fits into your program. LineTotal : Integer // This defines an Integer variable called LineTotalįirst,Second : String // This defines two variables to hold strings of text Var // This starts a section of variables Before we do, we'll show how to define a variable to Delphi: We'll cover the basic, simple types here. Like many modern languages, Delphi provides a rich variety of ways of storing data. When we give a name to such data, we also give it its permanent value. For example, the maximum number of lines that the Word Processor can handle. Sometimes, we may have data that we do not want to change. It can contain data such as a number or text. ![]() The program can freely read from and write to this memory slot. For example LineTotal might be used to name a memory slot that holds the total number of lines in a Word Processor document. Each memory 'slot' is identified by a name that the programmer chooses. It also uses data to control how it stores and formats what the user types and clicks.ĭata is stored in the memory of the computer when the program runs (it can also be stored in a file, but that is another matter beyond the scope of this tutorial). A Word Processor program has logic that takes what the user types and stores it in data. You cannot write a program of any real value without lines of code, or without data. ![]() For those new to computer programming, data and code go hand in hand. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |