MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Package File for Different Mathematica Versions

Andrew Beveridge wrote:
> I am writing a package file for Mathematica. I have two versions of 
> Mathematica targeted: 5.2 and 6.0.x.
> It would be nice to use some of the improvements in Version 6.0.x 
> without losing backwards compatibility with Version 5.2.
> I imagine one way to implement this would be the following:
> If $VersionNumber >= 6 then ... else ...
> However, I would prefer not to put a bunch of If statements into my 
> code; multiple lines would have to be modified. Is there are more 
> elegant way around this problem? Can a function be defined for a 
> particular versions of Mathematica in a package file?
> Thanks again for all of your help.
> Regards,
> Andrew
> Andrew C Beveridge
> MS M888
> Los Alamos National Laboratory
> Los Alamos, NM  87545
> 505-665-2092
> e-mail: acbev at

You can put whole function definitions inside an If:

If[$VersionNumber >= 6,
fff[]:=Print["Pre V6"]

David Bailey

  • Prev by Date: Re: delta function
  • Next by Date: Boolean constraints in plot functions
  • Previous by thread: Package File for Different Mathematica Versions
  • Next by thread: Re: Package File for Different Mathematica Versions