Subject:
|
Re: nqc macros
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Wed, 22 Sep 2004 14:37:56 GMT
|
Original-From:
|
Doug Reiland <dreiland@ANTISPAMhotmail.com>
|
Viewed:
|
866 times
|
| |
| |
this is pseudo-code.
switch (Random(6) {
case 0:
// do something
break;
case 1:
break;
default:
}
more flexible, write a function for any seed
ProcessRandom(int which)
{
switch (Random(which) {
case 0:
// do something
break;
case 1:
break;
default:
}
....
ProcessRandom(6);
}
> From: roc <principio@ilimit.es>
> To: "Philippe Hurbain" <philohome@free.fr>
> CC: lego-robotics@crynwr.com
> Subject: Re: nqc macros
> Date: Wed, 22 Sep 2004 13:28:32 +0200
>
> > You could use a lot of nested "if", but the best solution is to use the
> > "switch" statement
>
> right, but then i get confused on how to tell "switch" about the expression
> i mean with "if" i did:
>
> if (Random(1) == 0)
> {
> blabla
> }
> else
> {
> blabla
> }
>
> but how do i tell "switch" i want it to check the value of Random(6) and
> execute different cases?
> thanks!!
> r
>
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|