Save
ocr alevel comp sci
pseudocode
Save
Share
Learn
Content
Leaderboard
Learn
Created by
worms r us
Visit profile
Cards (8)
assign
a
variable
x=3
assign
a
global variable
global variable = 123
Variables
can be
typecast
using the
int
str
and
float
functions
str(3)
returns
“3”
int(“3”) returns 3
float(
“3.14”
) returns 3.14
outputting
to screen
print
(
string
)
count
controlled iteration
for
i=0
to
7
print(“Hello”)
next
i
condition controlled iteration
while
answer!=”computer”
answer=
input
(“What is the
password
?”)
endwhile
do
answer=input(“What is the password?”)
until
answer==”computer”
if entry==”a”
then
print(“You selected A”)
elseif entry==”b” then
print(“You selected B”)
else
print(“Unrecognised selection”)
endif
switch/case
switch entry:
case “A”:
print(“You selected A”)
case “B”:1
print(“You selected B”)
default
:
print(“Unrecognised selection”)
endswitch