Question: optional parameter in a procedure ?

Dear friends, 

Lets say I have this procedure here. 
graph := proc(fn::anything, t::{integer, name}) if type(t, integer) then return fn; else return plot(fn, gridlines); end if; end proc

Currently it returns a function from input if I provide an addtional argument in integer form. And it provides the graph for the function if I include an extra argument of type name. 

However I would like to do (if possible) is to using the same proc to make the parameter t optional instead. Meaning if type 

graph(x^2)  then it only returns the input and if I type graph(x^2,g) then instead it returns the graph of the input function. 

Is this possible to do? I have this paragraph in the help files https://www.maplesoft.com/support/help/Maple/view.aspx?path=parameter_classes#optional But I am not sure if thats the way to go? 

Hope somebody has a hint/idea? Best regards 

Please Wait...