Programming: Variables, Selection, Iteration and Strings - Cambridge IGCSE Class 10 Computer Science Notes, Diagrams and Solved Questions

Write real programs from the IGCSE pseudocode rules: variables and constants, the five basic data types, input and output, arithmetic (including DIV, MOD and powers), relational and logical operators, IF, nested IF and CASE, FOR, WHILE and REPEAT loops, totalling and counting, and string handling, with every example in pseudocode, Python and Java.

In this chapter

  • Declare variables and constants and use INPUT and OUTPUT
  • Choose INTEGER, REAL, CHAR, STRING or BOOLEAN for any data
  • Use + − * / ^, DIV and MOD, relational and logical operators
  • Write IF, nested IF and CASE statements
  • Choose between FOR (with STEP), WHILE and REPEAT … UNTIL loops
  • Total and count inside loops, with a rogue value
  • Handle strings with LENGTH, SUBSTRING, UCASE and LCASE
  • Nest loops and selection, and write validation loops