Both of those lines are fine?
#5

Quote:
Originally Posted by HazardouS
Посмотреть сообщение
Your code looks like this, with a little coding style:
pawn Код:
new i = strfind(text, advword), j = i + strlen(advword)-1; //line 1
text[i++] = '[';                                                           //line 2
while(j<j)                                                                  //line 3
{                                                                              //line 4
    text[i] = '•';                                                           //line 5
    i++                                                                       //line 6
}                                                                              //line 7
Now that your code looks cleaner and it has lines, let's take a look at it.
Line 1 is fine.
Line 2 is fine.
Line 3:
- while (j < j) is like saying "while 1 < 1, do something". 1 will never be less than 1, they are equal.
- I think you wanted to say "while(i<j)"
Line 4 is fine.
Line 5 is fine.
Line 6:
- This is called incrementation, you are adding 1 to i.
- You forgot to add a semi-colon (the symbol ';') at the end of it.
Line 7 is fine.

The correct version:
pawn Код:
new i = strfind(text, advword), j = i + strlen(advword)-1;
text[i++] = '[';
while(i<j)
{
    text[i] = '•';
    i++;
}
Thank you very much! - Repped +2
Reply


Messages In This Thread
Both of those lines are fine? - by Glossy42O - 06.02.2015, 17:42
Re: Both of those lines are fine? - by HazardouS - 06.02.2015, 17:46
Re: Both of those lines are fine? - by Glossy42O - 06.02.2015, 17:50
Re: Both of those lines are fine? - by HazardouS - 06.02.2015, 18:21
Re: Both of those lines are fine? - by Glossy42O - 06.02.2015, 18:27

Forum Jump:


Users browsing this thread: 1 Guest(s)