Skip to content

How to use multiple types? #7

@AmikoAce

Description

@AmikoAce

Hi,

I tried the following code, attempting to use two types :
@params(bool,float,float)
@rtype(float)
def IfCond(c,a,b):
if c==True :
return a
return b

recevied the following error:

File "twoTypes.py", line 64, in IfCond
if c==True :

TypeError: 'bool' object is not callable

I wanted my function to receive a boolean value (produced by a function with a boolean rtype, for example) and return either a or b, depending upon that value

Could anyone please correct my code, or provide a working example with a boolean-returning function, used by a float-returning function?

Thanks in advance!
Ami

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions