Replies To: How to pass variable(s)?

Re: How to pass variable(s)?

Posted 01 February 2013 - 08:22 AM

Having one method rely on 2 other methods like this should really be designed in advanced. You are just gonna give yourself a headache over it.

There are solutions, but it can usually make your code buggy and hard to follow. (such as using global variables) Your code is already kinda hard to follow, and I'm not quite sure what your methods are trying to accomplish.

Perhaps add comments on what your code is doing, and what the overall method is trying to accomplish then it would be easier to give some advice on how to design around this.

Re: How to pass variable(s)?

Perhaps add comments on what your code is doing, and what the overall method is trying to accomplish then it would be easier to give some advice on how to design around this.

Hi Kinaces, thank you for your time!

Basically, this is homework, and I've been allocated with a robot which has led lighting. For one of our homework's, we have to make the robot produce colours by taking in a word user input (from keyboard), and to be able to read off a text file. The colScanner method is suppose to read off the keyboard input and produce the colours of the letters, whilst the colReader method is suppose to read off of a text file (the word), and output the colours of the word. The methods colScanner and colReader are selected via a menu option, and they're then suppose to carry pass their variable(s) to the colProduce method which produces the colours of the letters.