Computing Theory: BBC Basic Coding Year 11. Lesson Objective You will: Be able to define what BBC...

Post on 22-Dec-2015

212 views 0 download

Transcript of Computing Theory: BBC Basic Coding Year 11. Lesson Objective You will: Be able to define what BBC...

Computing Theory: BBC Basic Coding

Year 11

Lesson Objective

You will:

• Be able to define what BBC basic is

•Be able to annotate BBC basic code

•Be able to write a piece of BBC Basic code

What is BBC Basic Coding?

• A programming language developed in 1981 as a native programming language

• It is a basic programming language adapted for UK computer literacy project within the BBC

Ignoring a line of code

• In Python, using a # will tell the program to ignore that line of code

• In BBC Basic, we use REM to tell the program to ignore that line of code

Example:

REM the area of a circle

BBC Basic CommandsPrint - displays a message on the screenInput – asking the user to input a variable

For loop –

for i = 1 to 10 print i

What do you think the code above will print?

Task 11 REM My program to test the input command

2 PRINT “Welcome to my program”3 PRINT “Please enter your age: “ 4 INPUT Age5 PRINT Age; “ is a great age to be!”

Print the code and annotate it to use as a revision aid

TaskLine 2 and 3 are simple PRINT commandsLine 4 is our new INPUT command – it tells us that whatever number the user enters should be stored in a box (variable) called AgeLine 5 is a new way of using the PRINT command. We are using it to put two things on the screen, the contents of the age variable and some more writing. These two items are separated by a semi colon. Notice how the variable does not need any quotation marks, but the writing does?

Task 2

1. Write a program that asks for your favourite number, and then replies that it is its favourite number tooSave as faveNum

2. Write a program that asks for 2 numbers and then says that the second number is its preferred number

Variable TypesType  Description Examples Range Character

Floating point Decimals 3.142, 0.001, 1E10-2

–5.9E-39 to 3.4E38 # or none

Integer Whole numbers 32000, 4, -66 –2147483648 to +2147483647 %

Byte Whole numbers 0, 128, 255 0 to 255 &

String Text "BBC BASIC", "Hello"

any number of characters from 0 to 65535

$