Computer Science Canada Something is wrong with my code. |
Author: | ProgrammedAlec [ Tue Nov 11, 2008 9:41 pm ] | ||
Post subject: | Something is wrong with my code. | ||
so me and a friend were experimenting, trying to figure out how to create an accurate matrix text-fall. here is the code he sent me which I "think" is somewhat completed, but when I try to run it, it gives me an error on this part: var four, five, six, seven, eight, nine, ten, eleven, twelve: int right on the FOUR. I don't know why. If I can get to run this properly I can continue to work with this but I cant run it for some reason! Can anyone help me out? PS. This forum has friendly users.
Mod edit: Remember to use [ code ] [ /code ] tags when posting code! |
Author: | [Gandalf] [ Tue Nov 11, 2008 9:46 pm ] |
Post subject: | RE:Something is wrong with my code. |
You're redeclaring four and all the other 'number' variables. What's the purpose of the twelve previous lines if you have that one there? Also, before continuing I strongly suggest you look into arrays and for loops. |
Author: | ProgrammedAlec [ Tue Nov 11, 2008 9:57 pm ] | ||
Post subject: | RE:Something is wrong with my code. | ||
Okay, now here's what I got after Editing according to half of Tony's details.
|
Author: | BigBear [ Tue Nov 11, 2008 10:45 pm ] |
Post subject: | Re: Something is wrong with my code. |
No he means you declare your variables one on each line as an int. Then you declare them again. |
Author: | Tony [ Wed Nov 12, 2008 12:00 am ] |
Post subject: | Re: RE:Something is wrong with my code. |
ProgrammedAlec @ Tue Nov 11, 2008 9:57 pm wrote: according to half of Tony's details
What? |
Author: | [Gandalf] [ Wed Nov 12, 2008 2:32 am ] |
Post subject: | Re: Something is wrong with my code. |
Ya I just banged my head against my keyboard and closed the page. ![]() ![]() Sorry Alec, but you're making the same mistake again in your new code. Try removing the first 9 lines of your new code, they're just repeats of your later variables. |
Author: | Euphoracle [ Wed Nov 12, 2008 6:50 am ] |
Post subject: | RE:Something is wrong with my code. |
Your title says "Tony's Clone"... People are silly (: |
Author: | sierius [ Mon Nov 17, 2008 9:24 pm ] | ||||||
Post subject: | RE:Something is wrong with my code. | ||||||
What are you trying to get the script to do ? You could use arrays if you wanted.
Hope this helps. You question would be easier to understand if you stated what the script is for. Edit : Forgot to code Edit : One more note By changing the value in
currently represented by '12' You change the entire script in terms of how many numbers will be inserted to be randomized and printed. Ie. You input
20 numbers will be given a randomized value and which be printed |
Author: | andrew. [ Tue Nov 18, 2008 6:17 pm ] |
Post subject: | RE:Something is wrong with my code. |
You are declaring your variables (var one : int) and then after you go to 12, you redeclare it again which causes an error. Take out some of the declarations so that there is one var one, one var two, etc. Also, instead of doing that, I highly recommend you look into arrays. Just head over to the Turing tutorials section. |