Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

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


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 02, 2012 at 01: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
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2021-10-16 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (70 votes). Check out past polls.

    Notices?