Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update snippets
Co-Authored-By: Don Syme <[email protected]>
  • Loading branch information
albert-du and dsyme committed Nov 19, 2021
commit c34a82bd5ed7cdd112a9be81554d877f04def16b
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ let writeToConsole string1 string2 =

let writeToFile string1 string2 =
use writer = new StreamWriter(Environment.GetCommandLineArgs().[1], false)
try
writer.WriteLine $"{string1}\n{string2}"
with _ -> printfn "File write operation failed..."
writer.WriteLine $"{string1}\n{string2}"

let concat =
Action<string, string>(
Action<string, string>(fun string1 string2 ->
if Environment.GetCommandLineArgs().Length > 1 then
writeToFile
writeToFile string1 string2
else
writeToConsole
writeToConsole string1 string2
)

concat.Invoke(message1, message2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ let writeToConsole string1 string2 =

let writeToFile string1 string2 =
use writer = new StreamWriter(Environment.GetCommandLineArgs().[1], false)
try
writer.WriteLine $"{string1}\n{string2}"
with _ -> printfn "File write operation failed..."
writer.WriteLine $"{string1}\n{string2}"

let concat =
ConcatStrings(
ConcatStrings(fun string1 string2 ->
if Environment.GetCommandLineArgs().Length > 1 then
writeToFile
writeToFile string1 string2
else
writeToConsole
writeToConsole string1 string2
)

concat.Invoke(message1, message2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ let writeToConsole string1 string2 =

let writeToFile string1 string2 =
use writer = new StreamWriter(Environment.GetCommandLineArgs().[1], false)
try
writer.WriteLine $"{string1}\n{string2}"
with _ -> printfn "File write operation failed..."
writer.WriteLine $"{string1}\n{string2}"

let concat =
Action<string,string>(
Expand Down