Computer Science Canada how to make this function?? |
Author: | appling [ Tue Feb 24, 2004 3:13 pm ] | ||
Post subject: | how to make this function?? | ||
how could i make this program into a function
i tried a lot, who can help me??? ![]() ![]() |
Author: | shorthair [ Tue Feb 24, 2004 3:20 pm ] |
Post subject: | |
Function Hello * * * * end Hello Hello |
Author: | appling [ Tue Feb 24, 2004 3:29 pm ] |
Post subject: | |
i dont know how to call the function, so can u write the code and let me have a look? |
Author: | recneps [ Tue Feb 24, 2004 3:49 pm ] | ||
Post subject: | |||
Functions are simple.
Simple Simple. |
Author: | appling [ Tue Feb 24, 2004 4:02 pm ] |
Post subject: | |
sorry, the teacher told me just use the function not the procedure.so... thank u all the same |
Author: | naoki [ Tue Feb 24, 2004 4:55 pm ] | ||||
Post subject: | |||||
The above poster is wrong, that's actually a procedure, not a function A function goes
calling it is different than a procedure. You can't just run it normally. For example, if it returned a boolean answer, you would go
|
Author: | appling [ Tue Feb 24, 2004 5:13 pm ] | ||
Post subject: | |||
i tried this
but turing said "illegal put item" ??? i dont know where i am wrong |
Author: | naoki [ Tue Feb 24, 2004 5:45 pm ] |
Post subject: | |
i dunno, I don't really feel like running it but I'm guessing that Turing won't let you have a whole ARRAY as your returning value. I mean, think about it: Turing has NO idea how you want to output or result an array. Do you want to add/catenate the values? Do you want them output on the same line or seperate lines? Ambiguous cases aren't Turing's specialty also, if you look in your function you never declared "result" and then whatever you wanted. You just put exit. That means that it's supposed to return something, but you're not telling it what. Change the resulting value, and make sure you have one in your program. If you want to return an array value, that could work, but not the entire array |
Author: | shorthair [ Tue Feb 24, 2004 5:49 pm ] |
Post subject: | |
you need to result somthing , |
Author: | appling [ Tue Feb 24, 2004 5:50 pm ] |
Post subject: | |
what i need to do if i want the whole array(array a) as my result? and how to call it? |
Author: | Thuged_Out_G [ Tue Feb 24, 2004 10:38 pm ] |
Post subject: | |
your program doesnt output anything, it just does some variable changes if some conditions are true, so it would make more sense to make the program a procedure with parameters instead of a function. |
Author: | recneps [ Wed Feb 25, 2004 6:12 pm ] |
Post subject: | |
oops! haha, sorry there, i kinda started on functions and then got interrupted, and kinda changed to procedure :\ |
Author: | appling [ Wed Feb 25, 2004 9:28 pm ] | ||
Post subject: | |||
after a long time trying, i work it out at last ![]() ![]() ![]()
is this right/? thanks here to all the people ![]() ![]() |