Welcome to the Ranch!
You are very close! And you are right the problem is a variable scope.
The variable
factorial is declared inside a method and therefore is local to this method. It does not exist outside of this method.
You should not try to access a local variable that is used in a return statement.
You should actually call the method using its name
fact with a value
a.
You are already calling a method (but without parameters) on line 22.
So you should know how to do this.
In case of problems don't be afraid to ask.