Here is another version of the program with a negative value for the radius:
let radius = -25.08 let diameter = radius * 2.00
The F# language provides a special function used to evaluate an expression. The function is named assert and its syntax is:
The expression must evaluate to a true or false result. Here is an example:
let radius = -25.08 let diameter = radius * 2.00 assert (radius > 0.00)
When the assert() function is called, if it returns false, the compiler displays an error dialog box and stops. Here is an example:
If the function returns true, the program proceeds normally.