Question about return type
Author |
Message |
Geminias
|
Posted: Sat Nov 05, 2005 2:58 pm Post subject: Question about return type |
|
|
i'm going to write a module that will allow you to draw objects using turings graphic libraries by choosing the cordinates with your mouse rather than guessing at them with. the way it will work is this:
you essentially run the module in a program and you draw your picture on the run screen. then as a last option you save the picture to a file. then you call on that picture with your turing program, so kind of like paint except turing graphics paint lol.
i'm curious, cause for my functions i need a return type and i'm not sure what a function like drawfilloval (x1,y1,x2,y2,color) would return exactly.
does it return something? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Sat Nov 05, 2005 6:13 pm Post subject: Re: Question about return type |
|
|
Geminias wrote: i'm curious, cause for my functions i need a return type and i'm not sure what a function like drawfilloval (x1,y1,x2,y2,color) would return exactly.
does it return something?
drawfilloval does not return anything. It is a procedure. You know this because you don't have to pass the value returned by drawfilloval to anything, such as a variable. Doing something like
code: | var circle := drawfilloval (100, 100, 50, 50, 20) |
give you "drawfilloval is a procedure and hence does not return a value".
As for the value returned by your function, you've got three choices: It could be an int which represents the picture you just drew. (You know how Pic.FileNew returns an integer?) Second, you could return a string that is the name of the file you are writing to. (I'm not sure if you are actually saving the image as a bitmap type image, or as a series of points in a data file that will be connected by lines or some other means). Lastly, you could return nothing. |
|
|
|
|
![](images/spacer.gif) |
Geminias
|
Posted: Sat Nov 05, 2005 10:49 pm Post subject: (No subject) |
|
|
ahhh thanks, i figured it all out and got the mod working |
|
|
|
|
![](images/spacer.gif) |
|
|