Logmanager documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

With statement

The with statement is used to wrap execution block with defined context manager.

Block currently allows only one context defined at a time and is useful with Function context block.

Block XML representation

XML representation of statement_with block

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="statement_with">
    <value name="VALUE">
      <block type="with_item">
        <value name="VAR">
          <block type="function_context">
            <field name="NAME">bd0e8ea7-002a-4d5e-87af-6c623daf4b60</field>
            <value name="VALUE">
              <block type="text">
                <field name="TEXT">default</field>
              </block>
            </value>
          </block>
        </value>
        <value name="VALUE">
          <block type="variables_get">
            <field name="VAR" variabletype="">context_variable</field>
          </block>
        </value>
      </block>
    </value>
  </block>
</xml>

Example of visual representation

Block "With statement"

Block “With statement”