Vizavi

Write a code snippet with edge cases

Draft a compact code snippet for a defined input and output, including one working example and one edge case.

Prompt

In [language], write a small function for [inputs and desired output]. Preserve [ordering/constraints]. Show the implementation plus a normal example and an edge case with expected outputs, and explain any assumption that affects callers.
Open in Vizavi Chat

Illustrative source records

Worked example

  1. Input: list of optional labels
  2. Expected output: distinct nonempty labels in order
Example answer

Python: list(dict.fromkeys(label for label in labels if label and label.strip())). For ["blue", "", "blue", "red"] this returns ["blue", "red"]; an empty list returns [].

Suited for

Engineers and on-call leads.

Connectors

Use material you can access, or paste the relevant excerpt into your question.

Bring a real question to your next review.

Start with a meeting or agree a cross-system workflow with the people who own the sources.

Necessary storage supports sign-in and service operation. Optional product analytics stays off until you allow it. You can change your choice in Cookie settings. Cookie Policy