Shlomi Fish (shlomif) wrote in shlomif_tech,
Shlomi Fish
shlomif
shlomif_tech

  • Mood:
  • Music:

Tech Tip: Implementing assert() in PARI/GP

One can implement assert() in PARI-GP, a GPLed computer algebra system, using the error() function:

assert(cond,err)=if(!cond,error(err))
myfunc()=4
assert(myfunc()==5,"myfunc should return 5")

Licence

Copyright by Shlomi Fish, 2020.

You can reuse this entry under the Creative Commons Attribution 4.0 Unported licence, or at your option any later version of it. See the instructions on how to comply with it.

Whatever code given here is provided under the MIT / Expat licence.

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 0 comments