Marie Curie Marie Curie - 2 months ago 15x
Pascal Question

What's the equivalent for pred and succ in C#?

Pascal is my study language and I am curious whether C# also has the functions


This is what I have done in Pascal that I want to try in C#

// in Pascal:
pred(3) = 2
succ(False) = True
pred('b') = 'a'
type enum = (foo, bar, baz);
succ(bar) = baz; pred(bar) = foo

Is the same code applicable for C#, too? If so, what is the namespace for these functions?

(I searched Google, but couldn't find the answer)


There aren't pred and succ functions in C#. You just write n - 1 or n + 1.