Basic Pascal course
From scratch: everything you need to write your first programs. In DMarlon Studio, Pascal powers desktop apps with Lazarus (like the offline Odoo demo) and the console.
Start- 1Hello, worldYour first Pascal program: WriteLn prints text and results to the console. Compile it with Free Pascal or run it with F9 in DMarlon Studio.Lesson 1
- 2Variables and basic typesDeclare variables in Pascal's var block with the basic types (Integer, Double, Char, Boolean and String) and give them values with :=.Lesson 2
- 3Arithmetic: div, mod and /Do maths in Pascal: div for whole-number division, mod for the remainder, / for decimal division, and Trunc and Round to get back to integers.Lesson 3
- 4Formatting outputShape numbers in Pascal: WriteLn with :width:decimals and the Format function from SysUtils to line up the columns of a café receipt.Lesson 4
- 5Reading from the keyboardAsk the user for data with ReadLn in Pascal: text and numbers, one per line or several on the same line, to work out the price of cinema tickets.Lesson 5
- 6if, then and elseMake decisions in Pascal with if, then and else: weather warnings and exam grades, with begin…end blocks and else if chains.Lesson 6
- 7The case statementChoose between many values with case in Pascal: days of the week, grade ranges and the menu of a vending machine.Lesson 7
- 8Booleans and comparisonsCompare values in Pascal with =, <>, < and >, and combine conditions with and, or, not and xor to decide who rides the roller coaster.Lesson 8
- 9while and repeat…untilRepeat code in Pascal while a condition holds: while checks it before each pass and repeat…until checks it at the end.Lesson 9
- 10for loops with to and downtoCount with for in Pascal: to counts up, downto counts down, plus running totals, Char counters and nested loops for cinema seats.Lesson 10
- 11Static arraysStore several values of the same type in a Pascal array: a week of temperatures, with the average and the hottest day.Lesson 11
- 12Working with stringsWork with text in Pascal: join with +, then Length, Copy, Pos, UpperCase and LowerCase to split an email address into user and domain.Lesson 12
- 13ProceduresGroup named blocks of code into Pascal procedures, with parameters and local variables, to print a bakery receipt.Lesson 13
- 14Functions and ResultWrite Pascal functions that return a value through Result: Celsius to Fahrenheit, prices with VAT and whether a year is a leap year.Lesson 14
- 15var and const parametersPass Pascal parameters by value, by reference with var, and read-only with const, and return several results from one procedure.Lesson 15
- 16RecordsGroup related data in a Pascal record: a stationery shop's products with name, price and stock, plus functions that use them.Lesson 16
- 17Enumerated types and setsDefine enumerated types and sets in Pascal: a shop's opening days with in, Include, Exclude, Ord, Succ and set intersection.Lesson 17
- 18Dynamic arraysUse Pascal dynamic arrays that grow and shrink with SetLength: a shopping cart with routines to add items and total them up.Lesson 18
- 19Text filesWrite and read text files in Pascal with AssignFile, Rewrite, Append, Reset, ReadLn and CloseFile: a shopping list saved to disk.Lesson 19
- 20Project: a shop invoiceA small Pascal project that brings together records, arrays, loops, procedures and Format to print the invoice of a computer shop.Lesson 20