Thursday, 26 May 2011

200-300 words + Pseudo code

If/Else Function.

In coding the If/else statement states that if a certain action happens, for example if the mouse was pressed or something went over a certain point on the screen, then something would happen like the background might change colour. And the else part of the function is what is happening on the screen if that action doesn’t happen.

My metaphor is that the if/Else function is a pendulum with a magnet waiting to pick up or move a small magnetic object from underneath it.

My exhibition piece states that function quite well.
My exhibition piece is a pendulum. The pendulum has a circular magnet with a hole in the middle attached to a string.
There is a small magnetic object (like some paper clips, nails or something else magnetic) under the pendulum. If the pendulum goes over or past the small magnetic object, then the object will move in the direction that the pendulum is moving. Else if the pendulum is anywhere else in its motion then it won’t move the object.
I Think that this example gives the user a good idea on what the if/else function is and how it works.

Pseudo code

If (pendulums magnet is over small object) {
Small object moves in direction of pendulum
}
Else {Small object does not move}


No comments:

Post a Comment