“Redeclared s defined above without usage”

前端 未结 2 944
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-24 00:11
for i in range(10):
    s = 5
    for j in range(10):
        s = min(s)

The above code gives the title of this question as warning in IntelliJ for the

2条回答
  •  情书的邮戳
    2021-01-24 00:41

    It is what it says. You remade something without using it or defining it. Like for me, example:

    def car(e):
        color = "blue"
        print(color)
    
    def car(r):
    

    Run

    Error, I redefine the function, can't do that as far as I know, I didn't make it do anything. Thought I was using the function, didn't realize I was re defining it.

    correction

    def car(e):
        color = "blue"
        print(color)
    
    car(e)
    

提交回复
热议问题