What does this expression mean?

f==0?1:f*fact(f-1)

Recommended Answers

The expression condition ? then_expression : else_expression evaluates to the result of then_expression if condition evaluates to true and to else_expression otherwise.

So the above expression evaluates to 1 if f is 0 and to f * fact(f-1) otherwise.

Jump to Post

All 2 Replies

The expression condition ? then_expression : else_expression evaluates to the result of then_expression if condition evaluates to true and to else_expression otherwise.

So the above expression evaluates to 1 if f is 0 and to f * fact(f-1) otherwise.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.