public module ShowIIF public sub Main() Dim input as String = "Junior" Dim parsed as Integer parsed = IIF(IsNumeric(parsed), CInt(input), -1) end sub End module
Standard input is empty
Standard output is empty
Unhandled Exception: System.InvalidCastException: Conversion from string "Junior" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in the correct format at System.Int32.Parse (System.String s) [0x00000] at Microsoft.VisualBasic.CompilerServices.IntegerType.FromString (System.String Value) [0x00000] --- End of inner exception stack trace --- at Microsoft.VisualBasic.CompilerServices.IntegerType.FromString (System.String Value) [0x00000] at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger (System.String Value) [0x00000] at ShowIIF.Main () [0x00000]