Python Forum
difference between statement and expression
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
difference between statement and expression
#2
It's always a good idea to start with documentation:

Expression:

Quote:A piece of syntax which can be evaluated to some value. In other words, an expression is an accumulation of expression elements like literals, names, attribute access, operators or function calls which all return a value. In contrast to many other languages, not all language constructs are expressions. There are also statements which cannot be used as expressions, such as while. Assignments are also statements, not expressions.

Statement:

Quote:A statement is part of a suite (a “block” of code). A statement is either an expression or one of several constructs with a keyword, such as if, while or for.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
RE: difference between statement and expression - by perfringo - Oct-16-2023, 12:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  yield usage as statement or expression akbarza 5 985 Oct-23-2023, 11:43 AM
Last Post: Gribouillis
  List Creation and Position of Continue Statement In Regular Expression Code new_coder_231013 3 1,775 Jun-15-2022, 12:00 PM
Last Post: new_coder_231013
  Pass results of expression to another expression cmdr_eggplant 2 2,374 Mar-26-2020, 06:59 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020