Skip to content

Instantly share code, notes, and snippets.

@swlaschin
Last active December 30, 2020 15:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swlaschin/d35b59795a85a62723124df1a79d2388 to your computer and use it in GitHub Desktop.
Save swlaschin/d35b59795a85a62723124df1a79d2388 to your computer and use it in GitHub Desktop.
Code examples from fsharpforfunandprofit.com/posts/dependencies/
(* ===================================
Code from my series of posts "Six approaches to dependency injection"
=================================== *)
open System
(* ======================================================================
1. Dependency Retention
In which we don't worry about managing dependencies,
and just inline and hard-code everything!
====================================================================== *)
let compareTwoStrings() =
printfn "Enter the first value"
let str1 = Console.ReadLine()
printfn "Enter the second value"
let str2 = Console.ReadLine()
if str1 > str2 then
printfn "The first value is bigger"
else if str1 < str2 then
printfn "The first value is smaller"
else
printfn "The values are equal"
// The only way to test this is manually
(*
compareTwoStrings()
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment