30 likes | 114 Views
Learn how to create a project in F# with tips on variables, redefinition errors, mutability, board setup, and formatting. Discover the importance of single-line statements and printing results in F#.
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