0
comment
comment
on 7/17/2015 5:56 AM
In a previous post on F# data access I dropped a hint about a functional way of handling invalid arguments. The code in question looked like this.
let insertLocation city state =
if state |> String.length >= 2
then DataAccess.createLocation city state
else raise (System.ArgumentException("Not a valid State"))
If you're new to the functional paradigm you may not see any issue with this code. To explain why this isn't an ideal solution let's first look at a simpler function.
let divide x[...]