Forums Register Login

Simple Program but what's wrong???

+Pie Number of slices to send: Send


I get the value 0 when its ran, not 2. Why???
+Pie Number of slices to send: Send

I know that this works correctly, but why does it not work the other way???
+Pie Number of slices to send: Send
Happy to help!

Your problem boils down to one major "oops". In your class method that changes the color.... take a look... a CLOSE look at exactly WHAT is getting set with the value of what! Hint.... you are setting the value of the argument with the current value of the int. To research this part, look up some info on "assignment" and I think you'll find the key.

The reason that it works in the second example is that, in the same handler as above, you are returning the value of the argument that you passed in NOT the value of the int. It will always pass back what you passed in.

Read this, take another look at these areas, and I think you'll find your answer!

Best of luck.
+Pie Number of slices to send: Send

Says, assign the current value of the variable anIntegerRepresentingColors to the variable newHue and then allow the newHue variable to fall out of scope.

What I think you want is:

+Pie Number of slices to send: Send
how about that, it works now. thanks I overlooked that.
+Pie Number of slices to send: Send
My pleasure.
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 784 times.
Similar Threads
Exeptions with Threads
Array of Objects
questions overriding , operators
Array
passing variables
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:48:19.