larger amounts of data and with information that requires a bit more structure

Larger amounts of data and with information that

This preview shows page 9 - 15 out of 20 pages.

larger amounts of data , and with information that requires a bit more structure, we need to be able to create variables that can contain more than a single piece of information. Arrays allow more that one piece of data to be assigned to a variable , plus they can contain different data types. COMP1073 - MODULE TWO - VARIABLES, OPERATORS & STRINGS
Image of page 9
LET’S CODE - EXAMPLE ONE COMP1073 - MODULE TWO - VARIABLES, OPERATORS & STRINGS
Image of page 10
A LITTLE ABOUT DECISIONS & LOOPS Providing the ability for code to execute decisions and run specific pieces of code based on the results is a critical part of any programming language. We can construct conditional statements and decision- making structures . We also need a way to enable a program or script to do something repetitively - l ooping structure s COMP1073 - MODULE TWO - VARIABLES, OPERATORS & STRINGS
Image of page 11
DECISION STRUCTURES if ... else statements switch statements ternary operators COMP1073 - MODULE TWO - VARIABLES, OPERATORS & STRINGS
Image of page 12
LET’S CODE - EXAMPLE TWO COMP1073 - MODULE TWO - VARIABLES, OPERATORS & STRINGS
Image of page 13
LOOPS A loop usually has one or more of the following features: A counter, which is initialized with a certain value — this is the starting point of the loop
Image of page 14
Image of page 15

You've reached the end of your free preview.

Want to read all 20 pages?

  • Spring '19
  • loop, 2.5%

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture