05AB1E, (削除) 23 (削除ここまで) (削除) 22 (削除ここまで) 20 bytes
Input taken as height, then width.
F„ -N_N1&l×ばつ'|.ø,
Explanation
F # height number of times do
N_ # current row == first row
~ # OR
N1<Q # current row == last row
„ - è # use this to index into " -"
×ばつ # repeat this char width-2 times
'| # push a pipe
.ø # surround the repeated string with the pipe
, # print with newline
05AB1E, (削除) 23 (削除ここまで) (削除) 22 (削除ここまで) 20 bytes
Input taken as height, then width.
F„ -N_N1&l×ばつ'|.ø,
Explanation
F # height number of times do
N_ # current row == first row
~ # OR
N1<Q # current row == last row
„ - è # use this to index into " -"
×ばつ # repeat this char width-2 times
'| # push a pipe
.ø # surround the repeated string with the pipe
, # print with newline
Saved 2 bytes thanks to Adnan
05AB1E, (削除) 23 (削除ここまで) (削除) 22 (削除ここまで) 20 bytes
Input taken as height, then width.
F„ -N_N1&l×ばつ'|.ø,
Explanation
F # height number of times do
N_ # current row == first row
~ # OR
N1<Q # current row == last row
„ - è # use this to index into " -"
×ばつ # repeat this char width-2 times
'| # push a pipe
.ø # surround the repeated string with the pipe
, # print with newline
Saved 2 bytes thanks to Adnan
05AB1E, (削除) 23 (削除ここまで) 22(削除) 22 (削除ここまで) 20 bytes
Input taken as height, then width.
FN_N1<Q~i'F„ -×ばつ'|N_N1&l×ばつ'|.ø,
Explanation
F # height number of times do
N_N1<Q~i'- N_ # ifcurrent we'rerow on== first orrow
~ # OR
N1<Q # current row == last row, push„ "-"
è ëð} # elseuse pushthis ato spaceindex char
into " -"
×ばつ # repeat this char width-2 times
'| '| # push a pipe
.ø # surround the repeated string with the pipe
, , # print with newline
Saved 2 bytes thanks to Adnan
05AB1E, (削除) 23 (削除ここまで) 22 bytes
Input taken as height, then width.
FN_N1<Q~i'-×ばつ'|.ø,
Explanation
F # height number of times do
N_N1<Q~i'- # if we're on first or last row, push "-"
ëð} # else push a space char
×ばつ # repeat this char width-2 times
'| # push a pipe
.ø # surround the repeated string with the pipe
, # print with newline
05AB1E, (削除) 23 (削除ここまで) (削除) 22 (削除ここまで) 20 bytes
Input taken as height, then width.
F„ -N_N1&l×ばつ'|.ø,
Explanation
F # height number of times do
N_ # current row == first row
~ # OR
N1<Q # current row == last row „ - è # use this to index into " -"
×ばつ # repeat this char width-2 times
'| # push a pipe
.ø # surround the repeated string with the pipe
, # print with newline
Saved 2 bytes thanks to Adnan
05AB1E, 23(削除) 23 (削除ここまで) 22 bytes
Input taken as height, then width.
F'|N_N1<Q~i'FN_N1<Q~i'-ëð}×ばつ'|J×ばつ'|.ø,
Explanation
F # height number of times do
'| # push pipe
N_N1<Q~i'- # if we're on first or last row, push "-"
ëð} # else push a space char
×ばつ # repeat this char width-2 times
'| # push a pipe
.ø J, # joinsurround rowthe andrepeated string with the pipe
, # print with newline
05AB1E, 23 bytes
Input taken as height, then width.
F'|N_N1<Q~i'-ëð}×ばつ'|J,
Explanation
F # height number of times do
'| # push pipe
N_N1<Q~i'- # if we're on first or last row, push "-"
ëð} # else push a space char
×ばつ # repeat this char width-2 times
'| # push a pipe
J, # join row and print
05AB1E, (削除) 23 (削除ここまで) 22 bytes
Input taken as height, then width.
FN_N1<Q~i'-ëð}×ばつ'|.ø,
Explanation
F # height number of times do
N_N1<Q~i'- # if we're on first or last row, push "-"
ëð} # else push a space char
×ばつ # repeat this char width-2 times
'| # push a pipe
.ø # surround the repeated string with the pipe
, # print with newline