Computer Science Canada

Function that requires variables

Author:  Tasoya [ Fri Jan 20, 2012 7:52 pm ]
Post subject:  Function that requires variables

Posted: Today at 7:44 pm Post subject: Turing help for a noob? Very Happy

Hey everyone,
I'm very new to turing so please let the criticism come along with help! So our class started doing fuctions and arrays in school, and I am just simply perplexed by how I would run an array through a function that has required variables. The question was to find if a number was prime in an array.

My question is: Is there a way to run a function with a variable inside? For example : function primer (var list :array 1..count of int):real... ? Count would be the amount of terms (count of it) inputted by the user prior into the array.


Thanks for reading this,
Sincerely, a very confused child
Confused

Author:  Insectoid [ Fri Jan 20, 2012 7:56 pm ]
Post subject:  RE:Function that requires variables

There is an example here.

EDIT: Damn docs can only link to the main page...
The example I mentioned:

code:
function total (a : array 1 .. * of real) : real

Author:  Tasoya [ Fri Jan 20, 2012 7:59 pm ]
Post subject:  Re: Function that requires variables

Thank you soooo much! Sorry for the bother with such an amateur question.

Author:  Tony [ Fri Jan 20, 2012 8:40 pm ]
Post subject:  RE:Function that requires variables

@Insectoid

[ tdoc ] function [/ tdoc] -- function


: