Functions, Control Structures and Expressions - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Functions, Control Structures and Expressions

Description:

Proximity where is it in relation to other objects? ... Spatial Relation orientation (left or right) of one object to another ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 13
Provided by: marybet67
Category:

less

Transcript and Presenter's Notes

Title: Functions, Control Structures and Expressions


1
Functions, Control Structures and Expressions
  • Programming with Alice

2
Instruction
A statement that executes to make objects perform
a certain action.
3
Control Structure
A statement that controls the execution of a
block of instructions.
4
Function
Asks a question about a condition or computes a
value.
5
Expression
A mathematical operation on numbers or other
kinds of values.
6
Alice Control Structures
  • Do In Order - done
  • Do Together - done
  • If/Else
  • Repetition

7
If/Else
  • Conditional execution uses functions and
    expressions to check a current condition in the
    world
  • Is the spider robots head red?
  • If the distance between the spider robot and rock
    greater than 1 meter?

8
If/Else
  • You can use a function to ask questions about
    these an objects properties
  • You can also use expressions to perform
    arithmetic operations on the values of those
    properties

9
Built-in Functions
  • Proximity where is it in relation to other
    objects?
  • Size how one objects size compares to another
    objects size
  • Spatial Relation orientation (left or right) of
    one object to another
  • Point of View position in the world
  • Other

10
Possible Values in Alice
  • Number
  • Boolean (true or false)
  • String (Hello)
  • Object

11
Repetition (Loops)
  • To add a loop, simply drag the loop statement
    into your program. It will prompt you to enter
    how many times you want the block of code to loop.

12
Fun Special Effects - Fog
  • To add fog, click on World
  • Now select properties
  • Play around with the values until you get the
    effect you like
Write a Comment
User Comments (0)
About PowerShow.com