Skip to content

implement: src/control_flow -- conditionals, match, if-let, while-let #2

@BryanChasko

Description

@BryanChasko

topic: control flow

rust mirror of conditionals. rust's match is exhaustive -- compiler enforces all cases.

concepts to demonstrate

  • if/else with type-consistent arms
  • match on integers, enums, tuples
  • if let for Option unwrapping
  • while let for streaming data
  • match guards

patriots theme

match on game state: quarter, score differential, field position.
if let Some(result) = game_log.get(week) pattern.

file

src/control_flow/game_state.rs

reference

python mirror: basic_match_name_input_NFL_legends.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions