# Saving file as .m causes it to save as comments

I am attempting to create a Package and so am saving a notebook with the code from Mathematica's example

BeginPackage["Collatz"]

Collatz::usage = "Collatz[n] gives a list of the iterates in the 3n+1 \
problem,
starting from n. The conjecture is that this sequence always
terminates."

Begin["Private"]

Collatz := {1}

Collatz[n_Integer] := Prepend[Collatz[3 n + 1], n] /; OddQ[n] && n > 0

Collatz[n_Integer] := Prepend[Collatz[n/2], n] /; EvenQ[n] && n > 0

End[]

EndPackage[]


And save it as a .m file. However, when I try to Get the file it doesn't work. So I did FilePrint as in their example and everything is commented.

Get["Desktop\Collatz.m"]

(* ::Package:: *)

(* ::Input:: *)
(*BeginPackage["Collatz"]*)
(**)
(*Collatz::usage="Collatz[n] gives a list of the iterates in the 3n+1 problem,*)
(*        starting from n. The conjecture is that this sequence always*)
(*        terminates."*)
(**)
(*Begin["Private"]*)
(**)
(*Collatz:={1}*)
(**)
(*Collatz[n_Integer]:=Prepend[Collatz[3 n+1],n]/;OddQ[n]&&n>0*)
(**)
(*Collatz[n_Integer]:=Prepend[Collatz[n/2],n]/;EvenQ[n]&&n>0*)
(**)
(*End[]*)
(**)
(*EndPackage[]*)


Am I doing something incorrect?

• The solution is to convert the relevant cells into initialization cells... – chris Aug 3 '15 at 19:10 