Using def in pipeline

Hello, please tell me why a def is needed when declaring a variable, what it means and in general where and when it is used ?

Without a concrete example the question is pretty vague, but it looks more to be a question about Groovy than Jenkins and Pipelines, in which case you probably want to review the Groovy documentation to understand better the Groovy syntax: The Apache Groovy programming language - Syntax

Well, at least there is a def call and there is a def new_variable - these def refer to groove or jenkins syntax. And the groove question can only be used in the pipeline in the script block