Hello,
i am trying to write a loop control statement.
I want to set the value of “Intensity” at 71
make the calculation above and write the value of “Intensity” only if “volexc1” it’s >1.
if not i will increase Intensity of 1 and do again the calculations
I thought and tryied with WHILE and For Statement but i am very beginner in coding can please someone help me with some examples?
thank you
Dany
let intensity = 71 ; let load = maxload * intensity / 100 ; let relint1 = load /( maxload / coeffexc1 )* 100 ; let maxrepexc1 =( 1.0278 - relint1 / 100 )/ 0.0278 ;
Hello. I think I need a little more information here. I notice that you have several variables in the code you shared that are not defined anywhere. Will all variable values be hardcoded like intensity is?
If everything is hardcoded, then you just need an if statement (not a while/for)
Hello…
Yes sorry the variable that are not declared are declared in the code before.
I want to check for wich values of Intensity (from 71 to 105) my calculation are >1
Intensity = 71
Make calculations
if the result is not > 1
make again calculation with 72 and so on until the value of the result is > 1.
If the value will be > 1 i will write the value of Intensity.
let intensity = 71;
for (; ; intensity++) {
//do calculations
if (volexc1 > 1) {
//update your element
break; //stop the loop
}
console.log(intensity);
}