I have the following function, albeit contrived:
Foo[x_Integer] :=
Module[{i},
i = 1;
While[i <= x && i <= 10, i++];
i - 1
];
I am looking for the following
Foo[1] = 1
.
.
.
Foo[10] = 10
Foo[11] = 10
Foo[Infinity] = 10
However Foo[Infinity]
returns Foo[\[Infinity]]
and not 10
.
Is there an something that I can do, short of: Foo[Infinity] = 10;
to get Foo[Infinity]
to return 10
? The problem is i <= 10
is static in my contrived example, but will be dynamic in practice.