We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm returning to processing after having been away for a time. I'm forgetting some details and I'm probably not aware of recent changes. Thanks in advance.
Answers
Have you consulted the reference? https://www.processing.org/reference/
Where are you seeing void display or void render?
I'm going through the Nature of Code book. The text (which understandably may not be up to date) has:
void display ()
.However I downloaded their up to date github code which uses
void render()
.I can not find any documentation on either.
class
.void
when referring to method/function names. It's pointless! 8-|I'm honestly not really sure what you're talking about.
A basic Processing sketch uses a draw() function, not render() or display(). Those might be methods used in a class somewhere, but it's not like Processing has changed its basic functions or anything.
Oh, okay. My misunderstanding. They are just method names. The code in question is in regards to a class. I mistakenly thought it was a part of the API. Thanks for the clarification. Also, Shiffman's code uses "void" for these method names. I'm not sure what his reasoning is behind that.
What were you expecting?
Java syntax demands that a function/method specify which datatype it returns.
Keyword
void
simply means that it returns nothing:https://processing.org/reference/void.html
My CS knowledge is spotty and inconsistent. Can anyone explain to me why void should or should not be used in a method name? It seems like there's a difference of opinion or am I misunderstanding this?
I just meant that calling a method
void setup()
is cumbersome. Just say the name w/ parens: setup(). ;)Functions have a return type, in the case of void it means that the functions returns nothing. If you had a function that returns say an integer then you can use that integer:
Also if it was not clear, display and render are arbitrary names for functions (the name chosen is probably just based on what the function does). The void before the function name is the return type
That makes sense, thanks.