Procedures, Functions, Arrays and File Handling - Cambridge IGCSE Class 10 Computer Science Notes, Diagrams and Solved Questions

Write procedures and functions with parameters, use local and global variables and the library routines MOD, DIV, ROUND and RANDOM, process 1D and 2D arrays with loops, and read and write files, in Cambridge pseudocode, Python and Java.

In this chapter

  • Procedures and parameters: PROCEDURE, CALL and passing arguments
  • Functions that RETURN a value, and how they differ from procedures
  • Local and global variables, and what makes a program maintainable
  • Library routines: MOD, DIV, ROUND and RANDOM
  • One-dimensional arrays: declaring, indexing, totalling and finding the highest value
  • Two-dimensional arrays and nested loops for row and column totals
  • File handling: OPENFILE, READFILE, WRITEFILE and CLOSEFILE
  • Scenario-style programs: a search function and a high score kept in a file