Computer Science Canada im having a syntax error (please run the program and you will see it. |
| Author: | Velocity [ Mon Nov 28, 2011 5:05 pm ] | ||
| Post subject: | im having a syntax error (please run the program and you will see it. | ||
Please specify what version of Turing you are using 4.1.1a It says it the variable has no value + bits to answerer/helper asap please and karma! |
|||
| Author: | Velocity [ Mon Nov 28, 2011 5:41 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
anyone?? please. still want to know. |
|
| Author: | Insectoid [ Mon Nov 28, 2011 5:45 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
Quote: It says it the variable has no value
Well, there's your problem. Turing told you what you did wrong. Try reading the error messages and figuring out what they mean. Also, this isn't a syntax error. It's a logic error. |
|
| Author: | Aange10 [ Mon Nov 28, 2011 5:45 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
You forgot the part where you tell us what you've tried. |
|
| Author: | ttm [ Mon Nov 28, 2011 6:57 pm ] | ||
| Post subject: | Re: im having a syntax error (please run the program and you will see it. | ||
I believe it's because your wordList array already has an initial size of 20, but when you read new values, you increase its size. Try changing line 4 of your program to read:
|
|||
| Author: | ttm [ Mon Nov 28, 2011 7:03 pm ] | ||
| Post subject: | Re: im having a syntax error (please run the program and you will see it. | ||
Also, you forgot to set values for your first and second variables. From the looks of it, you can set them to pretty much anything.
|
|||
| Author: | Velocity [ Tue Nov 29, 2011 12:01 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
ttm you gave me the best answer ever!!! Thank you so much! I love you. |
|
| Author: | Raknarg [ Tue Nov 29, 2011 12:47 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
I think it still make make it a problem if the wordList is 1 .. 1, try changing it to 1 .. 0 (aka an array with no elements to begin with) |
|
| Author: | ttm [ Tue Nov 29, 2011 4:12 pm ] | ||
| Post subject: | Re: im having a syntax error (please run the program and you will see it. | ||
Nope. In his code, he assigns before expanding the array, so there must be 1 blank spot first. See:
|
|||
| Author: | Raknarg [ Tue Nov 29, 2011 5:28 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
Why doesnt he resize it first and then assign it? He probably shouldnt have more elements than he's going to use. |
|
| Author: | ttm [ Tue Nov 29, 2011 5:42 pm ] |
| Post subject: | Re: im having a syntax error (please run the program and you will see it. |
1 extra element isn't going to make a difference. Also no @Velocity, no prob |
|
| Author: | Velocity [ Wed Nov 30, 2011 11:25 am ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
@ttm @raknarg i want to add the fact to allow the user to choose a letter in the word and if they get it right it pops up in a blank line of the word, like any other hangman game, how would i go about doing this? |
|
| Author: | Dragon20942 [ Wed Nov 30, 2011 1:14 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
Use an array to store each letter of the word, then check if any of the indexes are the guessed letter using a for loop. |
|
| Author: | Velocity [ Wed Nov 30, 2011 10:57 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
what do you mean by "check if any of the indexes are the guessed letter" - how would i go about donig that? |
|
| Author: | Aange10 [ Wed Nov 30, 2011 11:25 pm ] | ||
| Post subject: | Re: RE:im having a syntax error (please run the program and you will see it. | ||
Velocity @ 30/11/2011, 9:57 pm wrote: what do you mean by "check if any of the indexes are the guessed letter" - how would i go about donig that?
|
|||
| Author: | Dragon20942 [ Fri Dec 02, 2011 12:37 pm ] |
| Post subject: | RE:im having a syntax error (please run the program and you will see it. |
Read about arrays. An index of an array is the value in brackets after the array name which specifies what value in the array you are calling. |
|