pair number

Discussion in 'Cadence' started by nour, Jun 15, 2008.

  1. nour

    nour Guest

    hello!

    please how to check, by a skill function, that a number is pair?

    please answer me now, i'm in the office!!!

    Nour
     
    nour, Jun 15, 2008
    #1
  2. nour

    Riad KACED Guest

    Hi Nour,

    I like the way you're asking help ;-) Some other people would rather
    take it badly !
    We don't work on Sundays here in Europe so chances to get somebody are
    very weak ...
    Anyway, you should have read the SKILL Language User Guide more often
    because all those kind of questions are answered in there.
    Please give a look at Chapter 5, Arithmetic and Logical Expressions.
    You will find the following:

    Arithmetic Predicate Functions

    minusp(n) t if n is a negative number, nil otherwise
    plusp(n) t if n is a positive number, nil otherwise
    onep(n) t if n is equal to 1, nil otherwise
    zerop(n) t if n is equal to 0, nil otherwise
    evenp(x) t if x is an even integer, nil otherwise
    oddp(x) t if x is an odd integer, nil otherwise

    The function you're looking for is: evenp

    Riad.

    PS (sorry guys, it's in French).
    Le mot 'pair' existe en Anglais egalement mais c'est un faux ami, cad
    qu'il n'a pas le meme sens que le mot Francais. Le 'pair' en question
    se traduit par 'even' en Anglais et 'odd' pour impair. C'est tres
    simple a retenir en Anglais puisque 'even' est nombre pair de lettre
    et 'odd' est un nombre impair. Pour plus de details sur la
    signification de pair en Anglais:
    http://en.wiktionary.org/wiki/pair
    A+
     
    Riad KACED, Jun 15, 2008
    #2
  3. Riad KACED wrote, on 06/15/08 22:23:
    I'm glad you explained that Riad. I was trying to guess what Nour meant, and
    hadn't realised that "pair" mean "even" in French (my high school French never
    required me to know that, or if it did, it's long forgotten).

    Andrew.
     
    Andrew Beckett, Jun 16, 2008
    #3
  4. nour

    Riad KACED Guest

    Hi Andrew,
    It was rather an excuse to have a bit of escape from the forum and
    enjoying myself in scripting few words in French. Your French is
    actually not that bad since you've managed to understand the above;
    I'm not surprised at all ;-). I'm happy this helped anyway !
    Cheers,
    Riad.
     
    Riad KACED, Jun 16, 2008
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.