Skip to content

Commit

Permalink
Add imports to the readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Dec 11, 2024
1 parent a5f32d1 commit aeb5041
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ A package for encoding and decoding Morse code in Gleam.
## Usage

```gleam
import gleam/io
import morse
let text = "Hello world!"
case encode(text) {
case morse.encode(text) {
Ok(symbols) ->
io.println("The Morse code for " <> text <> " is " <> to_string(symbols))
Error(UnknownCharacter(char)) ->
Error(morse.UnknownCharacter(char)) ->
io.println_error("Invalid character: " <> char)
}
```
Expand Down

0 comments on commit aeb5041

Please sign in to comment.