2
$\begingroup$

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.

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

1 Answer 1

6
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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