randomizing
how do you make something random like case 1: and case 2: and stuff like that?
|
Re: randomizing
PHP Code:
|
Re: randomizing
okay i'm doing it right, thanks.
|
Re: randomizing
One question: When is the default brach executed ?!?
|
Re: randomizing
When something that isn't defined with "case <variable> :" like he did case 0-9, if something other then 0-9 was put in like 10 or -1, the default case would be in effect.
|
Re: randomizing
Wrong.
The default case will NEVER be executed because of the limits in random_num() |
Re: randomizing
This is what i'm doing and i think it's the best way I could do it. I'm half-way finished with the other stuff in the code but this is this random part; is it correct? i just started coding so please take it easy if somethings wrong
PHP Code:
|
Re: randomizing
Looks fine.
Although you can just switch the return value of random_num, you don't have to store it. |
Re: randomizing
could you explain that a little more please? sorry i just want to try to be good like alot of you guys
|
Re: randomizing
Quote:
The default case DOES execute if random_num returns 10. |
| All times are GMT -4. The time now is 16:02. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.