Quote:
Originally Posted by JM_Millers
The logic of the code depends on the scripter.
There are beginners who are building the structure of the code is wrong.
For example take the flow chart:
This is:
PHP код:
new a = 5, b = 7, c = 3;
if(a > b)
{
if(a > c)
{
printf("c - the largest number");
}
else
{
printf("a - the largest number");
}
}
else
{
if(b > c)
{
printf("b - the largest number");
}
else
{
printf("c - the largest number");
}
}
and this:
PHP код:
static a = 5, b = 7, c = 3;
if a >b && a > c *then return printf("a - the largest number");
if b >a && b > c *then return printf("b - the largest number");
if c >a && c > b *then return printf("a - the largest number");
The same, but in the second example above code logic.
|
PHP код:
printf("%d", max(max(a, b), c))
xD