Tuesday, December 7, 2010

Tuesday- Functions are so COOL!

Learning is key
  Today Mr.Arkin taught us about a new type of declaration called function, a function in Turing declares a variable and stores information within it. It also gives certain requirements to the variable to run. For example,


function product (number : real, number2 : real) : real 
result number * number2 
end product


put product (1,2)
put product (3,4)

  The variables number and number2 are local variables, this means that they can be only used within the function, if I were to put, put number, there would inevitably be an error. The error will state 'number' has not been declared. I believe functions will help me complete my programs in less time and more efficiency than what they are now. Programming is quite difficult however, if one get's it then it will become fun. This is why I love fiddling around with Turing, it teach's me new things. For example, I learned how to make a game from fiddling around with Turing and Turing help. It astounds me when I think of how many different outputs are possible from this one language, which is believed to be a simple language!    

No comments:

Post a Comment