Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: What is the difference between a Statement and an Expression?

by Boots111 (Hermit)
on Aug 02, 2001 at 17:41 UTC ( [id://101645]=note: print w/replies, xml ) Need Help??


in reply to What is the difference between a Statement and an Expression?

It seems like all of the answers drive at a fundamental difference. Expressions do something, while statement do not (always) do something.

Thus a quick and dirty answer would be that an expression is anything typically followed by a ;
If, else, while, and for do not usually have a ; after them because they just determine when (and how often) the assossiated expression is evaluated.

If is improtant to note that any expression with a return value can be used as a statement. For example
$x = $y; is an expression; however, it is used as the statement part of the expression
$z = ($x = $y); (the parentheses are just there for clarity).

Hope that helps,
Matt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://101645]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-24 02:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found