What is the difference between code cell and input cell?

enter image description here


1 Answer 1



  • Code is the default one in .wl .m files, content of Input in those cases will be commented so it won't run with << my.wl ( more: 9921
  • Input does a little formatting, auto indents, line wrap etc., in Code it is what you type.
  • Code is an InitializationCell so it will or ask you about evaluating it before you run anything in a fesh notebook. Could be nice or annoying, depending on your workflow.

Personal note, I prefer to control my formatting, don't care about 2D input and am annoyed by 'evaluate initialization cells prompt' so I work with .wl files with Code cells on daily basis.


styles = {CurrentValue[{StyleDefinitions, "Code"}], CurrentValue[{StyleDefinitions, "Input"}]};

{ Complement @@ styles, Complement @@ Reverse@styles } // 
  KeyUnion // Normal // Transpose // 
    { #[[1, 1]]
    , #[[1, 2]] /. m_Missing :> CurrentValue[{StyleDefinitions, "Code", m[[2]]}]
    , #[[2, 2]] /. m_Missing :> CurrentValue[{StyleDefinitions, "Input", m[[2]]}]
    } &
  ] // 
  Sort // Prepend[{"", "Code", "Input"}] // 
  Grid[#, Alignment -> Left, Background -> {{}, {{[email protected], None}}}, 
   Dividers -> {{2 -> True}, {2 -> True}}] &

enter image description here

  • $\begingroup$ Thank you. Is there any official recommendation from Wolfram which tone to use when? $\endgroup$
    – vasili111
    Feb 25 at 22:55
  • $\begingroup$ @vasili111 Is my edit enough? $\endgroup$
    – Kuba
    Feb 26 at 6:23
  • $\begingroup$ Yes. Thank you so much. $\endgroup$
    – vasili111
    Feb 27 at 19:48

Your Answer

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

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