expression contained across multiple cells

Is it possible to span one expression across multiple cells? E.g. long if statement or function evaluation. I looked in documentation and searched forum/google and could not find.

=================

1

 

I don’t think so. But given that you can format the expression inside the cell using the enter key, what would be the use of multiple cells?
– celtschk
Apr 15 ’14 at 15:41

  

 

Multiple cells for collapsable regions of code and text
– denfromufa
Apr 17 ’14 at 4:34

  

 

One option would be to factor out some of the code into separate definitions. If your code is so long that you would like to collapse parts of it, then doing so is probably a good idea anyway.
– celtschk
Apr 17 ’14 at 8:23

  

 

in Visual Studio you can add #region … #endregion collapsable parts of the code
– denfromufa
Aug 29 ’15 at 2:49

  

 

sometimes it is not possible to factor out into smaller pieces due to logic or performance
– denfromufa
Aug 29 ’15 at 2:50

=================

1 Answer
1

=================

No, this is not possible. A cell can only be evaluated if it contains a complete and syntactically correct expression.

You might want to try Code style cells (Alt-8 or Command-8) which contain plain text and allow arbitrary formatting with spaces, tabs and newlines.