develooper Front page | perl.perl6.users | Postings from March 2019

valid values?

Thread Next
From:
ToddAndMargo via perl6-users
Date:
March 3, 2019 10:09
Subject:
valid values?
Message ID:
c308d991-1516-3e85-e8cb-0d0fa82dfb8c@zoho.com
Hi All,

I want to pass an integer to a sub.  The only
valid values of the integer are 1, 2, 4, 8, and 16.

Other than using "if" to test their values, is
there a way to state that an integer can only
have certain predefined values?

Many thanks,
-T

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Having been erased,
The document you're seeking
Must now be retyped.
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About