- This topic has 0 replies, 1 voice, and was last updated 4 years, 1 month ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
aiannum.com has rebranded as Progaiz.com
› Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 2: [Arrays] – Functions, Variable and Scope, Debugging, Arrays, and Command Line Arguments › Revisiting loop in the first lecture
Tagged: loops in C
[dm_code_snippet background=”yes” background-mobile=”no” slim=”yes” line-numbers=”yes” bg-color=”#abb8c3″ theme=”dark” language=”clike” wrapped=”yes” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]
if (c == 'Y' || c == 'y')
{
printf("Agreed.\n");
}
else if (c == 'N' || c == 'n')
{
printf("Not agreed.\n");
}
[/dm_code_snippet]
This code from the first lecture appears loop but must not be a loop as mentioned “And if none of the expressions are true, nothing will happen since our program doesn’t have a loop.”
Could please anyone clarify what differentiates loop from the above code which is not a loop with if, else if. I do know there are three kinds of loop in C:
While
Do – While
For
Reply
https://edstem.org/us/courses/176/discussion/897635?comment=2047493[learn_press_profile]
