Skip to content

Commit

Permalink
review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
glennj committed Jan 16, 2024
1 parent 961f14a commit 8eda13c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions exercises/practice/leap/.approaches/external-tools/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Using GNU `date` to find the date of the day after February 28:
```bash
year=$1
next_day=$(date -d "$year-02-28 + 1 day" '+%d')
if [[ $next_day == "29" ]]; then
if [[ $next_day == 29 ]]; then
echo true
else
echo false
Expand All @@ -17,7 +17,7 @@ fi
Or, more concise but less readable:

```bash
[[ $(date -d "$1-02-28 + 1 day" '+%d') == "29" ]] \
[[ $(date -d "$1-02-28 + 1 day" '+%d') == 29 ]] \
&& echo true \
|| echo false
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ is_leap "$1" && echo true || echo false

The result of the arithmetic expression `year % 400 == 0` will be `1` if true and `0` if false.
The value is negated to correspond to the shell's return statuses: `0` is "success" and `1` is "failure.
Then the function can be used as a "Boolean condition" in the `if` statement.
Then the function can be used to branch between the "true" and "false" output.

The function's `return` statements can be written as

Expand Down

0 comments on commit 8eda13c

Please sign in to comment.