practical copy Flashcards
(128 cards)
Variable to store dates
DateTime
Prefix for DateTime variable
t
Methods for assigning date to DateTime variable
Convert from string
Convert from integer
Convert to DateTime from string
StrToDateTime(‘dd/mm/yyyy hh:mm:ss’);
Convert to DateTime from integer
EncodeDateTime(yyyy, mo, d, h, m, s);
Functions returning DateTime values
Yesterday - 00:00:00 of yesterday
Date - 00:00:00 of today
Tomorrow - 00:00:00 of tomorrow
Now - current date and time
How to do calculations with DateTime variable
Add/subtract number (or fractions of) DAYS to it
Functions performed on DateTime values
Type keywords (day, year, month, FormatSettings.Long) into ctrl+spacebar ; will usually return integer value
How to format DateTime
FormatDateTime(), for sFormat use letters : YMDH NSZ with - between
How to declare an array
Array[first..last] of type;
Steps to working with TextFiles
- Declare logical file in variable
- Assign physical file to logical file
- Set logical file to correct state
- Use file
- Close file
Declare file variable
fFile : TextFile
Assign file
AssignFile(fFile, ‘’)
States to set file to ***** include diff
Reset
Rewrite
Append
Close file
CloseFile(fFile)
How to read from textfile
Reset
ReadLn(fFile, sOutput) - moves to next line
How to write to textfile
Rewrite/append
WriteLn(fFile, sInput) - moves to next line
Write(fFile, sInput) - doesn’t move to next line
How to loop through textfile
Eof(fFile)
Input and output of methods
Parameters and return values
Difference between function and procedure
Both accept parameters but only functions return a value
Declare procedure
procedure ProcedureName(parameterName : type);
ctrl+shift+C
What do you use parameters as
Variable in method
How to use procedure
Type in name and input parameters
Declare function
function FunctionName(parameterName: type) : type;
Ctrl+shift+C