I'm asking this to find a consensus on whether it's okay for an answer to use True or False in place of the language's corresponding integer values -- as output in a sequence, for example.

So if the challenge is to output the Fibonacci sequence forever, and your output is

False, True, True, 2, 3, 5, 8, ...

and False==0 and True==1 in the language, then this would be acceptable. This is the case for Python. Some languages use -1 for True, so whatever the language uses for the Boolean value is the value that it may be substituted for.

So what do you think? I think it makes sense to allow it. I know there are already answers doing this, but I don't remember where.

  • 1
    \$\begingroup\$ I think this is more a question of "Can I use values of different types that are equal?". Other "related" questions would be "Could I return a list of integers and BigIntegers?" or "Can I return a list of characters and strings?" or "Can I return a list of stringified integers and normal integers?" \$\endgroup\$ Mar 22, 2017 at 14:38
  • \$\begingroup\$ IMO this is relevant here true/false is not a number and it's trivial to convert them in most languages. \$\endgroup\$
    – Downgoat
    Mar 22, 2017 at 14:38


Browse other questions tagged .