procedures, functions and arrays - how to
Author |
Message |
Jimbo1991
|
Posted: Tue Apr 08, 2008 12:52 pm Post subject: procedures, functions and arrays - how to |
|
|
i have a test tomarrow, on procedures, functions and arrays and, also on things like how to call a function, how to spot the errors in a code, and i havnt the slightest idea on how to make or do any of these! can anyone explain to me, and show me examples of each of these? thanks |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DaveAngus
|
Posted: Tue Apr 08, 2008 12:56 pm Post subject: RE:procedures, functions and arrays - how to |
|
|
Ask Mr Wilson! haha |
|
|
|
|
|
Nick
|
Posted: Tue Apr 08, 2008 2:11 pm Post subject: RE:procedures, functions and arrays - how to |
|
|
procedure:
code: | procedure foo
put "foo"
end foo
foo
%or
procedure foo (bar:string)
put bar
end foo
foo("Hello")
|
function:
code: | function foo:int
result 5
end foo
put foo
%or
function foo (bar:string):string
result bar
end foo
put foo("Hello")
|
arrays:
code: | var bar:array 1..5 of int
for i:1..5
bar(i) := i
end for
for i:1..5
put bar(i)
end for
|
|
|
|
|
|
|
Tony
|
Posted: Tue Apr 08, 2008 4:15 pm Post subject: RE:procedures, functions and arrays - how to |
|
|
we have tutorials to all of those, linked to from The Turing Walkthrough -- those would be an excellent read before a test. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|