Note the rights settings.
This means that execution happens once and then checking is done to see if the loop should be executed again.
I have changed the initial value of $ct to 5 before entering the loop.
The setting of $ct to 5 means the loop is done once, ct is incremented to 6 and the loop terminates. This would also work if I had set $ct to 4 initially since the increment happens before the test.
This while loop tests before entering the loop This while loop tests before entering the loop. If the condition is not met, processing never enters the loop.
SInce I started $ct at 5, the test with the while says $ct is not less than 5 so the loop is not entered and no math facts are printed.
The while loop checks what keeps you in the loop and the until checks what gets you out of the loop.
The second loop, the until, has $ct set to 6 prior to entering The second loop, the until, has $ct set to 6 prior to entering. The check finds that $ct is greater than 5 so the loop is not entered.
Remember, programming language must support sequence, decisions, and iteration to be languages. no else.
Note that I hardcoded values into the code.
Took out the { }
settings.
NN Here YY gets need, YN gets not need and N gets not need. Note that with N to the $dept=A question, I do not need to ask the second question. =.
Now I am asking the two questions separately and I have different processing for them all. Note the use of { }.
Note that when I change the if test to "A" to an = sign it does not work - actually the = does an assignment rather than a calculation.
assignment.
Since there are different messages or processing, I cannot combine.
With an OR you need only one so YY, YN and NN will be processed
can change the order of operation with parenthesis.