Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference of statement and expression in Ruby?

I know in Ruby, almost everything is an expression. Even those in other language such as if-else statement, case statement, assignment statement, loop statement is an expression in Ruby.

So I want to know from the Ruby's point of view, what's the difference between statement and expression?

like image 803
steveyang Avatar asked Mar 09 '12 15:03

steveyang


1 Answers

There is no difference between expressions and statement is Ruby. Everything evaluates to a value so everything is an expression.

like image 199
Aleksander Pohl Avatar answered Sep 18 '22 17:09

Aleksander Pohl