Re: Package File for Different Mathematica Versions
- To: mathgroup at smc.vnet.net
- Subject: [mg89966] Re: Package File for Different Mathematica Versions
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Wed, 25 Jun 2008 06:28:29 -0400 (EDT)
- References: <g3q7sh$arq$1@smc.vnet.net>
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 lanl.gov You can put whole function definitions inside an If: If[$VersionNumber >= 6, fff[]:=Print["V6"], fff[]:=Print["Pre V6"] ]; David Bailey http://www.dbaileyconsultancy.co.uk