30 likes | 110 Vues
CST223 Week 5 Lab. F# Demo Create a project in F# Interactive F#. F#: Some Tips. Variables are non-mutable by default: let x = 3 let x = 5 <= redefinition error x = 5 <= not allowed Can override it with mutable keyboard
E N D
CST223 Week 5 Lab • F# Demo • Create a project in F# • Interactive F#
F#: Some Tips • Variables are non-mutable by default: • let x = 3 • let x = 5 <= redefinition error • x = 5 <= not allowed • Can override it with mutable keyboard • let mutable board = [[‘-’;’-’;’-’];[‘-’;’-’;’-’];[‘-’;’-’;’-’]] • board <- (PlacePiece 1 1 ‘X’)
F#: Some tips • Formatting does seem to matter. • Single statement (if/then/else) needs to be on one line. • Use printfn to print out results or use interactive F# window to see results