Someone please explain nesting codes in simple terms , i am in highschool and I know nothing about coding | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Someone please explain nesting codes in simple terms , i am in highschool and I know nothing about coding

https://www.sololearn.com/discuss/2341595/?ref=app

12th Jun 2020, 6:58 AM
Clara Nasambu
Clara Nasambu - avatar
3 Answers
+ 4
Nesting can go beyond two identical statements. Many concepts include nesting. Every function has statements nested inside it. Some languages allow nesting functions within one another. All loops have nested statements just like those statements nested with Jenine's ifs. These levels of nesting might provide scope of name definitions. A variable declared in a for statement exists only within that statement including those nested. Once it completes, that variable is gone.
12th Jun 2020, 8:08 PM
John Wells
John Wells - avatar
+ 1
Hey _ clara_, Nested means when something is inside something else of the same type. For example an If statement is a block of code that executes based on a condition. A nested If statement would be: if (value) { console.log(“In first if statement”); if (nextValue) { console.log(“In nested if statement”); } } The second if statement (“if(nextValue)”) is nested because it is already within another if statement If you feel like you know nothing about coding, have a go at some of the language tutorials and it will introduce you to if statements and more. All the best with school!
12th Jun 2020, 9:28 AM
Jenine
0
Nesting is used when you have to get put your output combining two or more loging. For example: If(name=="ishan") { Console.log("my name is ishan") If(lastname=="shah") { Console.log("my name is ishan shah") } }
19th Jun 2020, 9:09 AM
Ishan Shah
Ishan Shah - avatar