IF,THEN and ELSE
Sequence
An instruction as shown bellow in the screenshot is not just the instruction but is set up as a sequence where the instruction/ instructions is set in a line of order that makes the most sense
Selection
IF- if the command code you write when you want a certain action to occur if so and so happens e.g. if person says hello A.I. reply's hello(if input name$ = "hello" then print "hello").
THEN- then is the command that follows the IF command where if the IF statement has been met THEN is the statement that follows up with an addition to the command or an end to it e.g. IF person says 'hello' THEN have A.I. replies with 'hello'.
ELSE- else is the command where if the requirement of the IF statement is not met then a different action will occur e.g. IF a person answers a question with the answer 'my favourite colour is blue' THEN reply with 'mine too' ELSE answer'that colours alright not my favourite thought'
Iteration
For Loop- A For Loop is a command that is used to allow code to be repeated constantly with the the keyword being 'for' for using it in code.
While Loop- A While Loop is a statement that allows for code to be repeated constantly according to a Boolean number that has been given e.g. While a= 7 do b.
Do Loop- A Do Loop is a statement that allows for code to repeat at least once depending on the Boolean given.
While Loop- A While Loop is a statement that allows for code to be repeated constantly according to a Boolean number that has been given e.g. While a= 7 do b.



Comments
Post a Comment