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
    $\begingroup$ 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? $\endgroup$ – celtschk Apr 15 '14 at 15:41
  • $\begingroup$ Multiple cells for collapsable regions of code and text $\endgroup$ – denfromufa Apr 17 '14 at 4:34
  • $\begingroup$ 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. $\endgroup$ – celtschk Apr 17 '14 at 8:23
  • $\begingroup$ in Visual Studio you can add #region ... #endregion collapsable parts of the code $\endgroup$ – denfromufa Aug 29 '15 at 2:49
  • $\begingroup$ sometimes it is not possible to factor out into smaller pieces due to logic or performance $\endgroup$ – denfromufa Aug 29 '15 at 2:50

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.