Jump to content
  • 0

For() Switch()...


Question

Posted (edited)

Hi.

How to make so that cases didn't repeat in function 'for() switch()'.

Example:

for(set .@a,0; .@a<3; set .@a,.@a+1)
{
switch(rand(1,3))
{
 case 1: (...); break;
 case 2: (...); break;
 case ...
 case N: (...); break;
}
}

Please, help.

Edited by Lilith

5 answers to this question

Recommended Posts

Posted (edited)

Gepard, sorry, i mean switch(rand(1,3)).

Emistry, with looping,

for(...)

{

switch(rand(1,N)){

case 1: setd ".Ex$",getd(".Ex$")+"First"; break;

case 2: setd ".Ex$",getd(".Ex$")+"Second"; break;

...

case N: setd ".Ex$",getd(".Ex$")+"N"; break;

}

}

In the end .Ex$ should be approximately so:

First, Fifth, Second - It is correct

First, Fifth, First -It is not correct, Because repeats...

Edited by Lilith

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...