Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by stuffy (Monk)
on Aug 03, 2001 at 07:55 UTC ( [id://101914]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

First of all, I ++ you for comming up with topic that generated as much conversation as this one has. If I were asked to define on a test the difference between the two, but I failed to study (which was usually the case in high school) I would probably write something like this:
A statement (in perl) is anything that is ended with a ";" while an expression is the part of a statement that actually does something like a mathematical computation, or the assigning of a value etc. The statement doesn't necessarly contain an expression. In reality, as long as you and those you are communicating with know what you are talking about, it doesn't matter what you call it.

Stuffy
That's my story, and I'm sticking to it, unless I'm wrong in which case I will probably change it ;~)
may be reproduced under the SDL
  • Comment on Re: What is the difference between a Statement and an Expression?

Replies are listed 'Best First'.
Re^2: What is the difference between a Statement and an Expression?
by JavaFan (Canon) on Mar 01, 2012 at 20:25 UTC
    A statement (in perl) is anything that is ended with a ";" while an expression is the part of a statement that actually does something like a mathematical computation, or the assigning of a value etc.
    So, in
    for (my $i = 0; $i < 10; $i++) { print "\$i = "; print $i }
    there are three statements, my $i = 0;, $i < 10; and print "\$i = ";, but print $i isn't, and neither is the entire for construct?

    Curious.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://101914]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.