My first attempt at F#
type Student(name,fives,tens,twenties) = member this.Name: string = name member this.Fives: int = fives member this.Tens: int = tens member this.Twenties: int = twenties member this.getStudentAmount with get () = (this.Fives * 5) + (this.Tens * 10) + (this.Twenties * 20) let a = new Student("a",1,1,1) let b = new Student("b",1,1,1) let c = new Student("c",1,1,1) let students = [|a;b;c|] |> Array.sortByDescending(fun x -> x.getStudentAmount) match students with |_ when students.Length = 1 -> students.[0].Name |_ when students.[0].getStudentAmount = students.[1].getStudentAmount -> "All" |_ -> students.[0].Name
I couldn't get the syntax highlighting for F# so if anyone can point me in the right direction that would be much appreciated.
```fsharp match students with |_ when students.Length = 1 -> students.[0].Name |_ when students.[0].getStudentAmount = students.[1].getStudentAmount -> "All" |_ -> students.[0].Name ```
renders as
match students with |_ when students.Length = 1 -> students.[0].Name |_ when students.[0].getStudentAmount = students.[1].getStudentAmount -> "All" |_ -> students.[0].Name
(HEY, dev.to maintainers, this is one of those "won't fix bugs!" 😠 Why can't I nest backticks as in the github flavored markdown spec?)
Thank you
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My first attempt at F#
I couldn't get the syntax highlighting for F# so if anyone can point me in the right direction that would be much appreciated.
renders as
(HEY, dev.to maintainers, this is one of those "won't fix bugs!" 😠 Why can't I nest backticks as in the github flavored markdown spec?)
Thank you