Code Review: a lot of if else #3289
Closed
cd155
started this conversation in
Show and tell
Replies: 1 comment 6 replies
-
To me, the best version would take in 2 records, each with 3 fields, called year, month and day. Taking a 3-tuple of ints is a very old style of coding. Then I would write a boolean predicate, using 'and', and not use if-then-else at all. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am currently taking an online class, and I would like to hear some feedback on the code I made. The code is made by Standard ML.
In the following three functions, each of them takes two arguments and returns a bool. Two arguments, named date1 and date2, are a tuple with 3
int
type. The firstint
is year, the secondint
is month, and the lastint
is day. The following three functions will check if date1 is order than date2. Which one do you prefer?Beta Was this translation helpful? Give feedback.
All reactions