about the possibilities with for loop(+Random function)
#1

Are the following for loops valid?

pawn Код:
for(new i=1;i<10;i*=2)
for(new i=100;i>10;i/=2)
for(new i=25;i>1;i%=10)
Also another doubt is,if i assign a value random(5) to a variable n make it print the number when i execute a command. If i try the command 5 times in a row, will i get completely different numbers all the time (like 1 4 2 3 0) or will any number get repeated (like 4 0 2 4 1)?
Reply
#2

Quote:
Originally Posted by DavidBilla
Посмотреть сообщение
Are the following for loops valid?

pawn Код:
for(new i=1;i<10;i*=2)
for(new i=100;i>10;i/=2)
for(new i=25;i>1;i%=10)
Also another doubt is,if i assign a value random(5) to a variable n make it print the number when i execute a command. If i try the command 5 times in a row, will i get completely different numbers all the time (like 1 4 2 3 0) or will any number get repeated (like 4 0 2 4 1)?
The numbers can be repeated with the random function, as it's entirely random. So there is always a chance you could have 4, 4, 4, 4, 4; but that's not likely at all.
Reply
#3

Quote:

Are the following for loops valid?

pawn Код:
for(new i=1;i<10;i*=2)
for(new i=100;i>10;i/=2)
for(new i=25;i>1;i%=10)
Yes .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)