SlideShare a Scribd company logo
PSEUDOCODE - HAGGIS
What is HAGGIS?
•

Haggis is very similar to programming language in which it has strictly defined
syntax and rules.
Formatting of HAGGIS
Keywords
Are all captitalised. For example SET, FOR, WHILE etc
1.

2. Line Numbers
Lines should be numbered as shown below using a capital L and a single space before each
number. This makes it easier to refer to certain parts of the pseudocode.
Line 1
Line 2
Line 3
A refinement of Line 1 would be shown as:
Line 1.1
Line 1.2
Formatting Cont.
3.

Indentation

The beginning and the end of some constructs should be highlighted by indenting the code inbetween
Line 1 REPEAT
Line 2
SET total = total + 5
Line 3 UNTIL total = 100
4.

Variable names

Simple variable names that use only one word should be written in lower case.
total
name
Any variables using more than one word should use capital letters. For example:

totalScore
firstName
Formatting Cont.
5. Data
If the data used is numeric then should be wrote on it’s own.
SET number TO 932
If the data is text then it is indicated by using “ ”.
SET name TO “bob”
What does it look like?
Variables / Arrays
If the Variable is set within the program, the command words SET & TO are used to assign values
to variables and Arrays.

Numeric:
SET number TO 973
String:
SET name TO “bob”
Array:
SET names[3] TO “John”
SET names[loop] TO “Jess”
What does it look like?
Variable and Arrays Cont.
If variables have been assigned a value as part of an input system. i.e. user has typed in
their name and stored in the variable name. Then the command used is RECEIVE & FROM

What device
is used to
input:

Variable
name
RECEIVE name FROM (string) KEYBOARD

Variable
type:
String
Integer
Real
Boolean

Keyboard
Mouse
Sensor
Touchscreen
Web Cam
Microphone
What does it look like?
Outputting Data
Numeric

SEND 23 TO DISPLAY

Variable

SEND total TO DISPLAY

String

SEND “The total is:” TO DISPLAY

Alternative

SEND “Print this Text” TO PRINTER
What does it look like?
Arithmetic Operators

Arithmetic operators are normally used with a SET or SEND

SET number TO 911+ 34
SET number TO 34/7
SEND 34*78 TO DISPLAY
SET total TO num1 + num2
What does it look like?
Expressions to Concatenate Strings
Text, number & variables may be concatenated with an ampersand (&) and enclosed by [ ]:
SET errorMessage TO [“Device failed due to fault number” & faultNumber]
SEND [“Player” & playerNumber & “’s score is” & playerScore] TO DISPLAY
What does it look like?
Conditions and logical operators

The command IF and THEN are used to make decisions
An IF statement with a simple condition can take two forms:

Single Line

IF temperatureNow>= 100 THEN SEND “Water is in a gaseous form at this temp” TO DISPLAY
Extended statement
IF temperatureNow >= 100 THEN
SEND “Water is in a gaseous form at this temp” TO DISPLAY
SEND “This is called steam” TO DISPLAY
ELSE
SEND “Water is a liquid or solid at this temp” TO DISPLAY

END IF
What does it look like?
Complex Conditions

Use of (AND, OR, NOT)
IF temperatureNow > 0 AND temperatureNow <100 THEN

SEND “Water is a liquid at this temp” TO DISPLAY
What does it look like?
Fixed loops
Code may be repeated a fixed number of times using FOR, FROM, TO, DO, END FOR.

FOR counter FROM 1 TO 10 DO
GET nextInput FROM (Real) Keyboard
SET totalCostTO totalCost + nextInput
END FOR
Alternatively, a fixed loop may also be written using the REPEAT, TIMES, END REPEAT commands:

REPEAT 10 TIMES
RECEIVED nextValue FROM (REAL) KEYBOARD
END REPEAT
What does it look like?
Conditional Loops
Loops may also be ended with a pre or post condition using WHILE, END WHILE or
REPEATE

Pre Condition
RECEIVE password FROM (STRING) KEYBOARD
WHILE password = “ “ DO
IF password = “Pass” THEN
SEND “Correct Password” TO DISPLAY
END IF
END WHILE
Post condition
REPEAT
RECEIVE password FROM (STRING) KEYBOARD
IF password = “Pass” THEN
SEND “Correct Password” TO DISPLAY
END IF
UNTIL password = “Pass”

More Related Content

Similar to Pseudocode haggis

Pseudocode
PseudocodePseudocode
Pseudocode
Harsha Madushanka
 
Variables and calculations_chpt_4
Variables and calculations_chpt_4Variables and calculations_chpt_4
Variables and calculations_chpt_4
cmontanez
 
2 int real
2 int real2 int real
2 int real
fyjordan9
 
Python programing
Python programingPython programing
Python programing
hamzagame
 
pythonQuick.pdf
pythonQuick.pdfpythonQuick.pdf
pythonQuick.pdf
PhanMinhLinhAnxM0190
 
python notes.pdf
python notes.pdfpython notes.pdf
python notes.pdf
RohitSindhu10
 
python 34đź’­.pdf
python 34đź’­.pdfpython 34đź’­.pdf
python 34đź’­.pdf
AkashdeepBhattacharj1
 
Python
PythonPython
Python
MeHak Gulati
 
23UCACC11 Python Programming (MTNC) (BCA)
23UCACC11 Python Programming (MTNC) (BCA)23UCACC11 Python Programming (MTNC) (BCA)
23UCACC11 Python Programming (MTNC) (BCA)
ssuser7f90ae
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with thisPHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
Ian Macali
 
Unit 2
Unit 2Unit 2
Unit 2
TPLatchoumi
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
Anonymous9etQKwW
 
Python-review1.pdf
Python-review1.pdfPython-review1.pdf
Python-review1.pdf
paijitk
 
Python-review1.ppt
Python-review1.pptPython-review1.ppt
Python-review1.ppt
snowflakebatch
 
Introduction to Python - Training for Kids
Introduction to Python - Training for KidsIntroduction to Python - Training for Kids
Introduction to Python - Training for Kids
Aimee Maree Forsstrom
 
Python-review1.ppt
Python-review1.pptPython-review1.ppt
Python-review1.ppt
jaba kumar
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
banubabitha
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
banubabitha
 
Php
PhpPhp
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
banubabitha
 

Similar to Pseudocode haggis (20)

Pseudocode
PseudocodePseudocode
Pseudocode
 
Variables and calculations_chpt_4
Variables and calculations_chpt_4Variables and calculations_chpt_4
Variables and calculations_chpt_4
 
2 int real
2 int real2 int real
2 int real
 
Python programing
Python programingPython programing
Python programing
 
pythonQuick.pdf
pythonQuick.pdfpythonQuick.pdf
pythonQuick.pdf
 
python notes.pdf
python notes.pdfpython notes.pdf
python notes.pdf
 
python 34đź’­.pdf
python 34đź’­.pdfpython 34đź’­.pdf
python 34đź’­.pdf
 
Python
PythonPython
Python
 
23UCACC11 Python Programming (MTNC) (BCA)
23UCACC11 Python Programming (MTNC) (BCA)23UCACC11 Python Programming (MTNC) (BCA)
23UCACC11 Python Programming (MTNC) (BCA)
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with thisPHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
 
Unit 2
Unit 2Unit 2
Unit 2
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
 
Python-review1.pdf
Python-review1.pdfPython-review1.pdf
Python-review1.pdf
 
Python-review1.ppt
Python-review1.pptPython-review1.ppt
Python-review1.ppt
 
Introduction to Python - Training for Kids
Introduction to Python - Training for KidsIntroduction to Python - Training for Kids
Introduction to Python - Training for Kids
 
Python-review1.ppt
Python-review1.pptPython-review1.ppt
Python-review1.ppt
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
 
Php
PhpPhp
Php
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
 

More from missstevenson01

S3 environment
S3 environmentS3 environment
S3 environment
missstevenson01
 
The Processor.pptx
The Processor.pptxThe Processor.pptx
The Processor.pptx
missstevenson01
 
How Computers Work
How Computers WorkHow Computers Work
How Computers Work
missstevenson01
 
Lesson 3 - Coding with Minecraft - Variables.pptx
Lesson 3 -  Coding with Minecraft -  Variables.pptxLesson 3 -  Coding with Minecraft -  Variables.pptx
Lesson 3 - Coding with Minecraft - Variables.pptx
missstevenson01
 
Lesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptxLesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptx
missstevenson01
 
Lesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptxLesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptx
missstevenson01
 
Lesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptxLesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptx
missstevenson01
 
Ethical hacking trojans, worms and spyware
Ethical hacking    trojans, worms and spywareEthical hacking    trojans, worms and spyware
Ethical hacking trojans, worms and spyware
missstevenson01
 
Ethical hacking anti virus
Ethical hacking   anti virusEthical hacking   anti virus
Ethical hacking anti virus
missstevenson01
 
Ethical hacking introduction to ethical hacking
Ethical hacking   introduction to ethical hackingEthical hacking   introduction to ethical hacking
Ethical hacking introduction to ethical hacking
missstevenson01
 
S1 internet safety-chattingonline
S1 internet safety-chattingonlineS1 internet safety-chattingonline
S1 internet safety-chattingonline
missstevenson01
 
S3 wireframe diagrams
S3 wireframe diagramsS3 wireframe diagrams
S3 wireframe diagrams
missstevenson01
 
Sql
SqlSql
Alien database
Alien databaseAlien database
Alien database
missstevenson01
 
Video Games and Copyright laws
Video Games and Copyright lawsVideo Games and Copyright laws
Video Games and Copyright laws
missstevenson01
 
Games Design Document
Games Design DocumentGames Design Document
Games Design Document
missstevenson01
 
Video game proposal
Video game proposalVideo game proposal
Video game proposal
missstevenson01
 
Evaluation
EvaluationEvaluation
Evaluation
missstevenson01
 
H evaluation
H evaluationH evaluation
H evaluation
missstevenson01
 
H testing and debugging
H testing and debuggingH testing and debugging
H testing and debugging
missstevenson01
 

More from missstevenson01 (20)

S3 environment
S3 environmentS3 environment
S3 environment
 
The Processor.pptx
The Processor.pptxThe Processor.pptx
The Processor.pptx
 
How Computers Work
How Computers WorkHow Computers Work
How Computers Work
 
Lesson 3 - Coding with Minecraft - Variables.pptx
Lesson 3 -  Coding with Minecraft -  Variables.pptxLesson 3 -  Coding with Minecraft -  Variables.pptx
Lesson 3 - Coding with Minecraft - Variables.pptx
 
Lesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptxLesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptx
 
Lesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptxLesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptx
 
Lesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptxLesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptx
 
Ethical hacking trojans, worms and spyware
Ethical hacking    trojans, worms and spywareEthical hacking    trojans, worms and spyware
Ethical hacking trojans, worms and spyware
 
Ethical hacking anti virus
Ethical hacking   anti virusEthical hacking   anti virus
Ethical hacking anti virus
 
Ethical hacking introduction to ethical hacking
Ethical hacking   introduction to ethical hackingEthical hacking   introduction to ethical hacking
Ethical hacking introduction to ethical hacking
 
S1 internet safety-chattingonline
S1 internet safety-chattingonlineS1 internet safety-chattingonline
S1 internet safety-chattingonline
 
S3 wireframe diagrams
S3 wireframe diagramsS3 wireframe diagrams
S3 wireframe diagrams
 
Sql
SqlSql
Sql
 
Alien database
Alien databaseAlien database
Alien database
 
Video Games and Copyright laws
Video Games and Copyright lawsVideo Games and Copyright laws
Video Games and Copyright laws
 
Games Design Document
Games Design DocumentGames Design Document
Games Design Document
 
Video game proposal
Video game proposalVideo game proposal
Video game proposal
 
Evaluation
EvaluationEvaluation
Evaluation
 
H evaluation
H evaluationH evaluation
H evaluation
 
H testing and debugging
H testing and debuggingH testing and debugging
H testing and debugging
 

Pseudocode haggis

  • 2. What is HAGGIS? • Haggis is very similar to programming language in which it has strictly defined syntax and rules.
  • 3. Formatting of HAGGIS Keywords Are all captitalised. For example SET, FOR, WHILE etc 1. 2. Line Numbers Lines should be numbered as shown below using a capital L and a single space before each number. This makes it easier to refer to certain parts of the pseudocode. Line 1 Line 2 Line 3 A refinement of Line 1 would be shown as: Line 1.1 Line 1.2
  • 4. Formatting Cont. 3. Indentation The beginning and the end of some constructs should be highlighted by indenting the code inbetween Line 1 REPEAT Line 2 SET total = total + 5 Line 3 UNTIL total = 100 4. Variable names Simple variable names that use only one word should be written in lower case. total name Any variables using more than one word should use capital letters. For example: totalScore firstName
  • 5. Formatting Cont. 5. Data If the data used is numeric then should be wrote on it’s own. SET number TO 932 If the data is text then it is indicated by using “ ”. SET name TO “bob”
  • 6. What does it look like? Variables / Arrays If the Variable is set within the program, the command words SET & TO are used to assign values to variables and Arrays. Numeric: SET number TO 973 String: SET name TO “bob” Array: SET names[3] TO “John” SET names[loop] TO “Jess”
  • 7. What does it look like? Variable and Arrays Cont. If variables have been assigned a value as part of an input system. i.e. user has typed in their name and stored in the variable name. Then the command used is RECEIVE & FROM What device is used to input: Variable name RECEIVE name FROM (string) KEYBOARD Variable type: String Integer Real Boolean Keyboard Mouse Sensor Touchscreen Web Cam Microphone
  • 8. What does it look like? Outputting Data Numeric SEND 23 TO DISPLAY Variable SEND total TO DISPLAY String SEND “The total is:” TO DISPLAY Alternative SEND “Print this Text” TO PRINTER
  • 9. What does it look like? Arithmetic Operators Arithmetic operators are normally used with a SET or SEND SET number TO 911+ 34 SET number TO 34/7 SEND 34*78 TO DISPLAY SET total TO num1 + num2
  • 10. What does it look like? Expressions to Concatenate Strings Text, number & variables may be concatenated with an ampersand (&) and enclosed by [ ]: SET errorMessage TO [“Device failed due to fault number” & faultNumber] SEND [“Player” & playerNumber & “’s score is” & playerScore] TO DISPLAY
  • 11. What does it look like? Conditions and logical operators The command IF and THEN are used to make decisions An IF statement with a simple condition can take two forms: Single Line IF temperatureNow>= 100 THEN SEND “Water is in a gaseous form at this temp” TO DISPLAY
  • 12. Extended statement IF temperatureNow >= 100 THEN SEND “Water is in a gaseous form at this temp” TO DISPLAY SEND “This is called steam” TO DISPLAY ELSE SEND “Water is a liquid or solid at this temp” TO DISPLAY END IF
  • 13. What does it look like? Complex Conditions Use of (AND, OR, NOT) IF temperatureNow > 0 AND temperatureNow <100 THEN SEND “Water is a liquid at this temp” TO DISPLAY
  • 14. What does it look like? Fixed loops Code may be repeated a fixed number of times using FOR, FROM, TO, DO, END FOR. FOR counter FROM 1 TO 10 DO GET nextInput FROM (Real) Keyboard SET totalCostTO totalCost + nextInput END FOR Alternatively, a fixed loop may also be written using the REPEAT, TIMES, END REPEAT commands: REPEAT 10 TIMES RECEIVED nextValue FROM (REAL) KEYBOARD END REPEAT
  • 15. What does it look like? Conditional Loops Loops may also be ended with a pre or post condition using WHILE, END WHILE or REPEATE Pre Condition RECEIVE password FROM (STRING) KEYBOARD WHILE password = “ “ DO IF password = “Pass” THEN SEND “Correct Password” TO DISPLAY END IF END WHILE
  • 16. Post condition REPEAT RECEIVE password FROM (STRING) KEYBOARD IF password = “Pass” THEN SEND “Correct Password” TO DISPLAY END IF UNTIL password = “Pass”