Spock by Rob Fletcher

Spock by Rob Fletcher

Author:Rob Fletcher
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2017-05-23T04:00:00+00:00


We’ll need a variable to track the character we’re going to use to fill each row.

We also need to know when we’ve gone past the halfway point in the diamond, because we’ll need to start reversing the order of the characters at that point.

Instead of appending a literal 'A' to each row, we now append our nextChar value.

Finally, at the end of each row we increment or decrement nextChar to get it ready for the next row. If nextChar is equal to the argument character, we know we’re at the halfway point and need to decrement nextChar until it’s back down to 'A' again.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.