Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialhitesh sahu
Courses Plus Student 80 Pointsprogram is not a set of statements, we can't apply set properties on it, shouldn't it be a collection of statements ?
If we apply set properties on a program, program flow will get changed and it will not work as it is supposed to !!
2 Answers
Susan Tussing
1,781 PointsJust in case this helps anyone else, I suspect the OP may have moved on by now, but... I'm guessing the OP may be ESOL? Or at least not accustomed to standard American usage. Yes, a mathematical set is a defined collection of distinct objects in which order is irrelevant. This is not referring to a program in terms of being a mathematical set, so the requirements, such as the order, and the operations you can perform on it aren't applicable. "Set" can be a simpler synonym for "collection", and generally can't be assumed to mean a set in the math sense when you're talking about it outside that context. A program's statements are definitely ordered, but they're still a set, they're just not that kind of set.
Jonathan Grieve
Treehouse Moderator 91,253 PointsHi Hitesh.
The default flow for any JS program is top to bottom. Unless you use things like functions, while loops and condition statements, the program will always just run one statement after the other from top to bottom. The only way you can change this is if you run certain actions based the value of a variable or an input prompt.
Sorry if all this sounds confusing. Just for now know that JS programs always run from top the bottom of your scripts.
hitesh sahu
Courses Plus Student 80 Pointsi understand that very well, In the video i heard "program is a set of statements" and i found it contradicting as set is a well defined collection of distinct objects with few properties like {a, b} = {b, c} and as in programs we can not just move statements up or down , so basically a program is collection rather than a set of statements. I think i'm right !
Jonathan Grieve
Treehouse Moderator 91,253 PointsI don't see the difference to be honest :-)