Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python and JavaScript output is different and order of function declaration in python #16

Closed
GoogleCodeExporter opened this issue Jun 18, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

I clicked the following simple program
<xml>
  <block type="variables_set" inline="false" x="134" y="56">
    <title i="1">item</title>
    <value i="0">
      <block type="math_number">
        <title i="0">0</title>
      </block>
    </value>
    <next>
      <block type="procedures_callnoreturn">
        <mutation name="procedure"></mutation>
        <next>
          <block type="text_print" inline="false">
            <value i="0">
              <block type="variables_get">
                <title i="1">item</title>
              </block>
            </value>
          </block>
        </next>
      </block>
    </next>
  </block>
  <block type="procedures_defnoreturn" x="348" y="69">
    <title i="0">procedure</title>
    <statement i="0">
      <block type="variables_set" inline="false">
        <title i="1">item</title>
        <value i="0">
          <block type="math_number">
            <title i="0">1</title>
          </block>
        </value>
      </block>
    </statement>
  </block>
</xml>
When running the JavaScript code the output is 1
When running the Python code the output is 0
Before running the Python code you have to move the function definition to the 
top of the program or you will get an error.

Either at global item in the python or var item in JavaScript inside the 
function definition would correct the Problem.
Or better let the user choose to have global or local variable.

Original issue reported on code.google.com by Gwa...@gmail.com on 5 Jun 2012 at 8:29

@GoogleCodeExporter
Copy link
Author

Fixed.  All functions are now declared at the top.  Thanks!

(Sorry, the XML format just changed, so the above code no longer compiles.)

Original comment by neil.fra...@gmail.com on 8 Jun 2012 at 11:58

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant