'how to iterrate the tool variable in jenkins groovy

In an example pilepline I saw a variable named tool and is used like this:

echo "${tool 'vs2017'}"
// Outputs C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin

My question is, what kind of variable is this? and how can I see what includes in this variable. I tried to print it like this but it fails:

tool.each { k, v -> echo 'k'}
groovy.lang.MissingPropertyException: No such property: tool for class: groovy.lang.Binding
  at groovy.lang.Binding.getVariable(Binding.java:63)
  at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:271)
  at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:353)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source