I have a custom function like following:
SyntaxInformation[
TwoNumberSameQ] = {"ArgumentsPattern" -> {_, _, OptionsPattern[]}};
Options[TwoNumberSameQ] = {ShowDifference -> False};
TwoNumberSameQ[x_, OptionsPattern[]] := {x,
OptionValue[ShowDifference]}
TwoNumberSameQ[a_, b_, OptionsPattern[]] :=
If[OptionValue[ShowDifference],
If[a === b, True, {False, Abs[a - b]}], If[a === b, True, False]]
Usage:
TwoNumberSameQ[3,4]
False
TwoNumberSameQ[3,4,ShowDifference->True]
{False, 1}
TwoNumberSameQ[3,3]
True
I have some dissatisfaction to this function.But the documentation have a little relative explanation for this area.
Question one
How to make the option have a black color like as a in-built function,but blue like:
Question two
How to make TwoNumberSameQ
's definition more concise.I just test one option but result so many repetitive code.I cannot imagine how mess when I set three or more option.
Addtional quesiton
If I can make the option have some optional values to choice.I'll be happy more. :)