2.2.1

Fundamentals

Test yourself

Variable Declaration and Assignment

A variable must be declared before a value can be assigned.

Illustrative background for DeclarationIllustrative background for Declaration ?? "content

Declaration

  • Before variables can be used, they must be declared.
  • Declaring a variable means telling the computer:
    • What the identifier (name) should be.
    • What type of data will be stored.
Illustrative background for AssignmentIllustrative background for Assignment ?? "content

Assignment

  • Changing the value stored inside a variable is called assignment.
  • The value assigned to a variable must match the data type of the variable.
Illustrative background for Language specificsIllustrative background for Language specifics ?? "content

Language specifics

  • Some languages don’t need you to declare variables before you use them:
    • These languages automatically declare the variable before the first assignment.

Input and Output

We need some method of getting data into and out of the computer. That's where input and output commands come in.

Illustrative background for InputIllustrative background for Input ?? "content

Input

  • Input is collecting data, usually by the keyboard.
  • This is written in pseudocode as:
    • INPUT "Please enter [something]..."
    • variable = USERINPUT
Illustrative background for OutputIllustrative background for Output ?? "content

Output

  • Output is putting data to the screen, usually as text.
  • This is written in pseudocode as:
    • OUTPUT "Text goes here"

Jump to other topics

1Computer Systems

1.1Systems Architecture

1.2Memory & Storage

1.3Computer Networks, Connections & Protocols

1.4Network Security

1.5Systems Software

1.6Ethical, Legal, Cultural & Environmental Concern

2Computational Thinking, Algorithms and Programming

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson