1 страниц (6 вхождений)
Many conditions - Сообщения
Здравствуйте.
Столкнулся со следующей проблемой: есть несколько условий, необходимо, чтобы при заданных значениях правильно бралось значение "а".
У меня почему-то игнорируется последнее условие - p0, то есть, в моем случае должно быть а=4, а программа выдает а=3.
Что я сделал не так?

proba.sm (11 КиБ) скачан 146 раз(а).
Столкнулся со следующей проблемой: есть несколько условий, необходимо, чтобы при заданных значениях правильно бралось значение "а".
У меня почему-то игнорируется последнее условие - p0, то есть, в моем случае должно быть а=4, а программа выдает а=3.
Что я сделал не так?

proba.sm (11 КиБ) скачан 146 раз(а).
I don't see error in Smath as the reports indicated in the third "If" are all verified and therefore does not even pass to the fourth "IF". Maybe you should add that P0 = 0 (or something else).
P.S. I also point out an OR in the fourth "IF" while all the others are AND: it could be an oversight
sergio
P.S. I also point out an OR in the fourth "IF" while all the others are AND: it could be an oversight
sergio
WroteI don't see error in Smath as the reports indicated in the third "If" are all verified and therefore does not even pass to the fourth "IF". Maybe you should add that P0 = 0 (or something else).
P.S. I also point out an OR in the fourth "IF" while all the others are AND: it could be an oversight
sergio
Спасибо, понял, что надо сделать - в первые три варианта прописал p0<100 и все заработало.
WroteСпасибо, понял, что надо сделать - в первые три варианта прописал p0<100 и все заработало.
You don't have to describe p<100. Just re-order the if statements.
In original, third statement if condition gets true regardless of p.0 value.
When it gets the true value in if condition, it won't be looked for next if.
Moving the p.0 boolean check to first will make all conditions available to read.
You can use cases() for smaller, tidier and much readable if blocks.
Using nested if() and cases() will reduce the huge block of boolean.
Your φ.n - λ.n - h.q checks are same for all, nesting λ under it is possible.
And you can also use multiple boolean conditions. lele(),lelt(),gege(), etc.
Regards
proba_r1.sm (5 КиБ) скачан 134 раз(а).

Maths lele.sm (8 КиБ) скачан 136 раз(а).
1 страниц (6 вхождений)
-
Новые сообщения
-
Нет новых сообщений