0

I was wondering if there is something in python similar to the begin expression in Scheme, and if not how would you write something in python to simulate it.

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by nam5a
0

You don't need a begin in Python,:

(if (condition)
  (begin
    (do-something-1)
    (do-something-2))
  do-something-else)
if condition:
    do_something_1
    do_something_2
else:
    do_something_else
0

Begin:

The <expression>s are evaluated sequentially from left to right, and the value of the last <expression> is returned. This expression type is used to sequence side effects such as input and output.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.