Forums Register Login

Can someone tell me why?

+Pie Number of slices to send: Send
Hello,

Can someone tell me why--after i create a cube--it display 'enter test operation' twice?



[ November 17, 2008: Message edited by: Bear Bibeault ]
+Pie Number of slices to send: Send
That's in a loop, so I'd assume that the loop is executed repeatedly. Check whether the loop termination condition works as you expect it to.

By the way, I'm almost positive that the getValue method does not work as you expect it to work. You may want to read about the "switch" statement, and what happens once one of the cases is matched.

Lastly, in the future UseAMeaningfulSubjectLine that states what the problem is.
[ November 17, 2008: Message edited by: Ulf Dittmer ]
+Pie Number of slices to send: Send
 

Originally posted by Ulf Dittmer:
That's in a loop, so I'd assume that the loop is executed repeatedly. Check whether the loop termination condition works as you expect it to.

By the way, I'm almost positive that the getValue method does not work as you expect it to work. You may want to read about the "switch" statement, and what happens once one of the cases is matched.

Lastly, in the future UseAMeaningfulSubjectLine that states what the problem is.

[ November 17, 2008: Message edited by: Ulf Dittmer ]



Is it because I'm using the getValue() switch statement on chars?

Thanks for your help
+Pie Number of slices to send: Send
No, chars work fine in switch statements. Ask yourself this: Suppose getFace() returns 't', causing "val = 1;" to be executed. Now, what is the next statement that gets executed? And consequently, which value of "val" will be returned from the method?
+Pie Number of slices to send: Send
 

Originally posted by Ulf Dittmer:
No, chars work fine in switch statements. Ask yourself this: Suppose getFace() returns 't', causing "val = 1;" to be executed. Now, what is the next statement that gets executed? And consequently, which value of "val" will be returned from the method?



how bout this?
+Pie Number of slices to send: Send
I think Ulf was hinting you should read about the break keyword in a switch statement
+Pie Number of slices to send: Send
FAQ: Use A Meaningful Subject Line

welcome,

history note:
the good ol' switch statement comes down to us from the C programming language, the first step up from assembly programming, and as such still requires a little bit more work to do what you want it to,

(i.e. check on the break keyword as suggested above - and/or trace through the debugger and see how it's executing)
[ November 17, 2008: Message edited by: Bill Shirley ]
Yup, yup, yup. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2229 times.
Similar Threads
Number of Objects eligible for Garbage Collection
Method Parameter/Argument Question
how to write the game-CrossingRiver (2)
Garbage collection doubt
how many objects will be eligible for garbage collection
More...

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