Forums Register Login

void type not allowed

+Pie Number of slices to send: Send
Where exactly am I going wrong?



It highlights the string "turns 21 in" as the error.

+Pie Number of slices to send: Send
It's complaining that you can't do

since that method is void.
1
+Pie Number of slices to send: Send
In the future, please UseCodeTags(⇐click) when posting code, so it will be readable. I've added them for you this time.

And welcome to the Ranch!
1
+Pie Number of slices to send: Send
What Jeff means is that you must have something after the + operator. If your method is void, then there is nothing there, and the + operator cannot operate on nothing.
1
+Pie Number of slices to send: Send
change your method to this:

+Pie Number of slices to send: Send
even better, I'd ditch the Difference variable all together, and just have the method return the computed value each time.

if you insist upon keeping it, at least follow proper naming conventions and call it "difference".
+Pie Number of slices to send: Send
Okay. Yeah this helped a ton. Thanks folks.
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1047 times.
Similar Threads
variables not found with OOP
Write and Read Records
need help wtih this code!
Using method on a program
Displaying things...need help badly!! Please!
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:30:05.