memesearch
Rust Elegant Grade Solution

Rust Elegant Grade Solution

Download Find similar pictures
Text on the meme
In Rust there's a very elegant solution: fn check_grade(grade: i32) → &'static str { match grade { 90..=100 ⇒ "A", 80..=89 ⇒ "B", 70..=79 ⇒ "C", 60..=69 ⇒ "D", 0..=59 ⇒ "F", _ ⇒ "Invalid grade", } } Ozan Yarci @ozanyrc 0 references This code structure is called an arrow anti-pattern. How to fix this code? public string CheckGrade(int score) { if (score >= 90) { return "A"; } else { if (score >= 80) { return "B"; } else { if (score >= 70) { return "C";
What it means

A programming meme contrasts a concise Rust grade-checking function with a deeply nested C# implementation of the same logic. The joke is that the elegant pattern-matching solution is presented above an exaggerated arrow anti-pattern, making the sprawling code look unnecessarily painful to maintain. EN: A programming meme contrasts a concise Rust grade-checking function with a deeply nested C# implementation of the same logic. The joke is that the elegant pattern-matching solution is presented above an exaggerated arrow anti-pattern, making the sprawling code look unnecessarily painful to maintain.

Who
Objects
Tags
Source
Type
image
Size
462×800 · 46.7 KiB
Mood
sarcastic, technical
Language
en
Added