The declaration of x is in the local scope of A. The variable x inside makespiralstairs has no declaration because x is not declared as global. Not a matter of order, it's a matter of scope. Passing x to the function will fix your issue. That or declare x as a global which I don't suggest. There's a lot of info online about local and global scope in Python and most other languages. It's important to utilize this so as not to accidentally override your values later
On Wed, Sep 13, 2017 at 11:26 AM jettam <[email protected]> wrote: > Inc = str(x+1) has been defined in the earlier "for x in" command has it > not ? > > I did another version earlier (with out a "for in" command in the second > function). And this worked without having to put a x in the > makeSpiralStairs() function. > > I made a order of events as I see it. (see the screen grab). Please let > me know how my understanding of the order is wrong. > > > <https://lh3.googleusercontent.com/-MtIriVJke6E/Wbl3Odq6bBI/AAAAAAABOsU/H61KYjlbscQLb3_O45DTPI30woHfD-NywCLcBGAs/s1600/Capture.JPG> > > > > On Wednesday, September 13, 2017 at 10:40:10 AM UTC-7, damonshelton wrote: >> >> Inc = str(x+1) >> X is not defined before this line >> >> X is defined when you execute the for x in range loop. You have to pass >> x into the makespiralstairs function to use it. X is a local variable >> >>> >>> -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/21848d44-b30b-46b2-822f-f9d37427f567%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/21848d44-b30b-46b2-822f-f9d37427f567%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM9RXoJD%2Bc3Q0EbVTFzXkqqvmzb3n8Jq7-06qx0WhT4TChd5Tw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
