Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/practice/house/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

BEGIN {
if (start < 1 || end > 12 || start > end) {
print "Error: invalid range. Start must be >= 1, end <= 12, and start <= end."
print "Error: invalid range. Start must be >= 1, end <= 12, and start <= end." > "/dev/stderr"
exit 1
}

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/nth-prime/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

BEGIN {
if (n < 1) {
print "invalid input"
print "invalid input" > "/dev/stderr"
exit(1)
}
if (n == 1) {
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/phone-number/.meta/example.awk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function die(msg) {
print msg
print msg > "/dev/stderr"
exit 1
}

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/protein-translation/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BEGIN {
out = ""
for (i = 1; i <= NF; i++) {
if (! translation[$i]) {
print "Invalid codon"
print "Invalid codon" > "/dev/stderr"
exit(1)
}
if (translation[$i] == "STOP")
Expand All @@ -34,7 +34,7 @@ BEGIN {
out = out translation[$i]
}
if (length % 3 && translation[$i] != "STOP") {
print "Invalid codon"
print "Invalid codon" > "/dev/stderr"
exit(1)
}

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/queen-attack/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ function abs(val) {
{
for (i = 1; i <= NF; i++)
if ($i < 0 || $i > 7) {
print "invalid position: row or column is not on the board"
print "invalid position: row or column is not on the board" > "/dev/stderr"
exit 1
}
if ($1 == $3 && $2 == $4) {
print "invalid position: pieces are on the same tile"
print "invalid position: pieces are on the same tile" > "/dev/stderr"
exit 1
}
# Same row or same column.
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/resistor-color-duo/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function value(color) {
for (i = 1; i <= length(colors); i++)
if (colors[i] == color)
return i - 1
print "invalid color"
print "invalid color" > "/dev/stderr"
exit(1)
}

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/resistor-color-trio/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function value(color) {
for (i = 1; i <= length(colors); i++)
if (colors[i] == color)
return i - 1
print "invalid color"
print "invalid color" > "/dev/stderr"
exit(1)
}

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/rna-transcription/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BEGIN {
if ($i in translation) {
out = out translation[$i]
} else {
print "Invalid nucleotide detected."
print "Invalid nucleotide detected." > "/dev/stderr"
exit(1)
}
}
Expand Down
8 changes: 4 additions & 4 deletions exercises/practice/series/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ BEGIN {
FS = ""
}

!NF { print "series cannot be empty"; exit(1) }
len == 0 { print "slice length cannot be zero"; exit(1) }
len < 0 { print "slice length cannot be negative"; exit(1) }
len > NF { print "slice length cannot be greater than series length"; exit(1) }
!NF { print "series cannot be empty" > "/dev/stderr"; exit(1) }
len == 0 { print "slice length cannot be zero" > "/dev/stderr"; exit(1) }
len < 0 { print "slice length cannot be negative" > "/dev/stderr"; exit(1) }
len > NF { print "slice length cannot be greater than series length" > "/dev/stderr"; exit(1) }

{
out = ""
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/space-age/.meta/example.awk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BEGIN {
if (earth_ratio[$1]) {
printf("%.2f\n", ($2 / seconds_per_earth_year) / earth_ratio[$1])
} else {
print $1 " is not a planet"
print $1 " is not a planet" > "/dev/stderr"
exit(1)
}
}