Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions docs/control_structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ These expressions also work inside :ref:`subroutines <subroutine_expr>`.
Chaining Expressions: :code:`Seq`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The :any:`Seq` expression can be used to create a sequence of multiple expressions. It takes a
single argument, which is a list of expressions to include in the sequence. For example:
The :any:`Seq` expression can be used to create a sequence of multiple expressions. It's arguments are the
expressions to include in the sequence, either as a variable number of arguments, or as a single list

For example:

.. code-block:: python

Seq([
Seq(
App.globalPut(Bytes("creator"), Txn.sender()),
Return(Int(1))
])
)

A :code:`Seq` expression will take on the value of its last expression. Additionally, all
expressions in a :code:`Seq` expression, except the last one, must not return anything (e.g.
Expand All @@ -44,21 +46,21 @@ add things to the TEAL stack. As a result, the following is an invalid sequence:
.. code-block:: python
:caption: Invalid Seq expression

Seq([
Seq(
Txn.sender(),
Return(Int(1))
])
)


If you must include an operation that returns a value in the earlier
part of a sequence, you can wrap the value in a :any:`Pop` expression to discard it. For example,

.. code-block:: python

Seq([
Seq(
Pop(Txn.sender()),
Return(Int(1))
])
)

.. _if_expr:

Expand Down