Hello I have written the following code.
My objective was to write a function called getWoeid which will check if the command line parameter is an array with 1 element, and that element is an integer.
My code works... but I am calling the TryParse method two times... I wonder if there is a way in which I can call this only once.
Also, can you confirm if this way of using pattern matching for validating command line parameters is correct?
open System;
open System.Xml;
let getWoeid args =   
  let retVal = 0
  match args with      
  | [|a|] when fst (Int32.TryParse(a)) = true -> 
      printfn "%s" "Starting the processing for woeid "
      Some(snd (Int32.TryParse(a)))      
  | _ -> failwith "Usage XmlRead WOEID"       
[<EntryPoint>]
let main args = 
  let woeid= 
    try   
      getWoeid args          
    with
      | Failure (msg) -> printfn "%s" msg; None
  0
 
     
    