g | x | w | all
Bytes Lang Time Link
039AWK241106T211013Zxrs
028Raku Perl 6 rakudo241213T165528Zxrs
007MathGolf241108T080212ZKevin Cr
032Haskell241107T015432ZDannyu N
005Japt mR170602T231445ZShaggy
005Vyxal j210529T071115Zemanresu
031Zsh210529T065022Zpxeger
004Canvas180908T160040Zdzaima
007Charcoal170603T004814ZNeil
019Perl 5171022T031741ZXcali
011J171021T205309ZFrownyFr
049R171021T200343ZRudier
050Tcl171021T192915Zsergiol
036JavaScript ES6170603T101056ZShaggy
011APL Dyalog170608T123445ZAdá
145brainfuck170604T162156Zvityavv
010CJam170604T180238ZEsolangi
046C170603T000516Zdbandstr
025PowerShell170602T231233Zcolsw
078C#170603T195925ZArthur R
055Bash170602T232227ZConor O&
008Pyke170603T152818ZBlue
009Ohm170603T153303ZDatboi
014QBIC170603T082717Zsteenber
007V170603T074545Zuser4180
026Python 3170603T060501Zovs
005Pyth170602T230202ZMaria
074Go170603T013054Ztotallyh
032Retina170603T003639ZNeil
197#+170602T234555ZConor O&
007Japt170602T232415ZETHprodu
070R170602T232532ZGiuseppe
007Jelly170602T230424ZJonathan
007MATL170602T225413ZLuis Men
00605AB1E170602T225253ZEmigna
032Python 2.7170602T223848ZKoishore
012J170602T223503ZConor O&
005SOGL170602T222300Zdzaima
026Mathematica170602T221951ZZaMoC

AWK, 43 39 bytes

{for(;i<$2*$1;)printf"[]"(i++%$1?RS:X)}

Attempt This Online!

{for(;i++<$1;)s=s"[]";for(;j++<$2;)print s}

Raku (Perl 6) (rakudo), 28 bytes

$a,$b {put "[]"xx$a for ^$b}

Attempt This Online!

$a,$b {  # columns, rows
put "[]" # print a box
xx$a     # repeat $a times
for ^$b} # repeat $b lines

MathGolf, 7 bytes

û[]*a*n

Inputs in the order \$w,h\$.

Try it online.

Explanation:

û[]     # Push string "[]"
   *    # Repeat it the first (implicit) input-integer amount of times as string
    a   # Wrap this string into a list
     *  # Repeat it the second (implicit) input-integer amount of times as list
      n # Join this list by newlines
        # (after which the entire stack is output implicitly as result)

PS: Æû[]*p (loop with print - 6 bytes) wouldn't work, because MathGolf starts from the first implicit input again when it runs out of inputs, instead of reusing the final input if there are no more, like most golfing languages do (e.g. inputs 4,2 would result in output "[][]\n[][][][]\n[][]\n[][][][]" instead of the intended "[][]\n[][]\n[][]\n[][]").

Haskell, 48 32 bytes

m!n=[1..n]>>([1..m]>>"[]")++"\n"

Try it online!

Japt -mR, 13 12 5 bytes

Takes input in reverse order

Vç"[]

Try it

Vyxal j, 6 5 bytes

ƛk[⁰*

Try it Online!

Takes height then width.

-1 thanks to lyxal.

ƛ      # map 0...(height) to...
 k[    # `[]`
    *  # repeated...
   ⁰   # (width)
    *  # times
       # (j flag) join by newlines

Zsh, 31 bytes

repeat $1 S+=[]
repeat $2 <<<$S

Try it online!

Canvas, 4 bytes

[]×*

Try it here!

Charcoal, 8 7 bytes

EN×[]Iη

Try it online! Link is to verbose version of code. Takes input in the order height, width. Charcoal's drawing primitives aren't suited to this, so this just takes the easy way out and repeats the [] string appropriately. Explanation:

 N      First input as a number
E       Map over implcit range
      η Second input
     I  Cast to number
   []   Literal string
  ×     Repeat
        Implicitly print on separate lines

Perl 5, 19 bytes

say for('[]'x<>)x<>

Try it online!

J, 11 bytes

,./@$'[]'"0

Try it online!

R, 49 bytes

s=scan;cat(rep(c(rep("[]",s()),"\n"),s()),sep="")

Ungolfed :

s=scan # Creates an alias for the scan function

cat( # Prints to STDOUT
    rep( # The repetion of the following string :
        c(rep("[]",s()),"\n"), # "[]" repeated the number of times inputed by the user, followed by a linebreak
    s()), # This number of time (again, user inputed)
sep="") # with no separator

Tcl, 50 bytes

proc B w\ h {time {puts [string repe {[]} $w]} $h}

Try it online!

JavaScript (ES6), 43 36 bytes

From the comments, a trailing newline is now permitted.

w=>h=>("[]".repeat(w)+`
`).repeat(h)

Try it

f=
w=>h=>("[]".repeat(w)+`
`).repeat(h)
oninput=_=>o.innerText=f(+i.value)(+j.value);o.innerText=f(i.value=2)(j.value=2)
*{font-family:sans-serif;}
input{margin:0 5px 0 0;width:50px;}
<label for=i>w: </label><input id=i type=number><label for=j>h: </label><input id=j type=number><pre id=o>

APL (Dyalog), 11 bytes

'[]'⍴⍨⊢,2×⊣

Try it online!

'[]' the string

⍴⍨ cyclically repeated to fill the shape

 right argument (rows)

, and

 twice

the left argument (columns)

brainfuck, 145 bytes

+++++++++[>++++++++++<-]>+[>+>+<<-]>>++>,>+++++++++[<----->-]<--->>>,>+++++++++[<----->-]<--->++++++++++<[<<<[>+>+<<-]>[<<<.>.>>-]>[<<+>>-]>>.<-]

Try it online!

My first ever code golf! Yay!

The input is in ascii + 48, so in order to do 50, 50 you must input b, b (the ascii letters for 98)

Explanation

+++++++++[>++++++++++<-]>+ Get the opening square bracket into first position
[>+>+<<-] Get it into the second and third position
>>++ Get the third position to be the closing bracket
>
,>+++++++++[<----->-]<--- Get first number into fourth cell
>>>
,>+++++++++[<----->-]<--- Get second number into seventh cell
>++++++++++ get newline into 8th position
<

[ Start our height loop
<<<[>+>+<<-] Get the width into the fifth and sixth positions
>[ Start our width loop at the fifth position
<<<.>. Print the second and third positions
>>-] Decrement the fifth position
>
[<<+>>-] copy the sixth position into the fourth position
>>. print newline
<-]

CJam, 10 bytes

l~"[]"*N+*

 

C, 47 46 bytes

f(w,h){for(h*=w;h--;)printf(h%w?"[]":"[]\n");}

or

f(w,h){for(h*=w;h--;)printf("[]%c",h%w?0:10);}

My first code golf attempt, did I miss anything obvious?

PowerShell, 25 Bytes

param($w,$h),("[]"*$w)*$h

-3 thanks to Mathias!

C#, 78 bytes

(w,h)=>"".PadLeft(h).Replace(" ","".PadLeft(w).Replace(" ","[]")+'\n').Trim();

Run in C# Pad

This is shorter than with for-loops and I'm not aware of any function in C# which can repeat with less code.

Bash, 55 bytes

seq $(($1*$2))|sed s/.*/[]/|tr -d "
"|fold -w $(($1*2))

Try it online! Uses the TIO flavor of bash, since I run windows.

Pyke, 8 bytes

}A;**"[]

Try it here!

Also 8 bytes:

 F2K*"[]

Try it here!

Ohm, 9 bytes

M"[]"َJ,    

Try it online!

Explanation

M"[]"َJ,
M         //Executes code input1 times
 "[]"     //Pushes []
     َ   //Duplicates [] input2 times
       J  //Joins the stack
        , //Prints with a trailing newline

QBIC, 14 bytes

[:|?[:|?@[]`';

Explanation:

[:|     FOR a = 1 to (read input from cmd line)
?       PRINT a newlne
[:|     FOR c = 1 to (read input from cmd line)
?@[]`   PRINT A$ (containing the box)
';         and inject a semicolon in the compiled QBasic code to suppress newlines

This takes its arguments in the order of #rows, #cols. Output starts with a newline.

V, 7 bytes

Ài[]<esc>ÀÄ

where <esc> is 0x1b.

Try it online!

Explanation

Ài[]<esc>                    " arg1 times insert []
         ÀÄ                  " arg2 times duplicate this line

Python 3, 26 bytes

lambda n,m:('[]'*n+'\n')*m

Try it online!

Pyth - 7 5 bytes

-2 bytes by a clever trick thanks to insert_name_here

VE*`Y

Try it here

Explanation:

VE*`Y
V      # Loop
 E     # <input> number of times
   `Y  # String representation of empty list (used to be "[]", but insert_name_here pointed out this shorter alternative)
  *    # repeat string implicit input number of times
       # implicit print

Go, 74 bytes

import."strings"
func(x,y int)string{return Repeat(Repeat("[]",x)+"\n",y)}

Try it online!

Retina, 32 bytes

.+
$*
1(?=1*(¶1+))|.
$1
G`1
1
[]

Try it online! Takes height and width input on separate lines.

;#+, 197 bytes

>;;;;;;~++++++++:>~;;;;:>~*(-:~<~+-::>-:::<~<-+++++++++~:::<~+-:::>-::*)-::<-::::>-::(;)::>-::*(-:~<~+-::>-:::<~<-+++++++++~:::<~+-:::>-::*)-:<~<;;;;;-+>-:<-:-(-:::~<-:::(~<#<-;;-#~;)-:<#-::<;>-:-)

Try it online! Requires a zero byte after each input number.

I kinda don't know how this works. What I can tell you is that this part of the code:

 *(-:~<~+-::>-:::<~<-+++++++++~:::<~+-:::>-::*)-::<-::::>-::(;)::>-::*(-:~<~+-::>-:::<~<-+++++++++~:::<~+-:::>-::*)

is parsing the input numbers.

Japt, 7 bytes

6 bytes of code, +1 for the -R flag.

VÆç"[]

Doesn't work in the latest version due to a bug with ç, but it does work in commit f619c52. Test it online!

Explanation

VÆ   ç"[]
VoX{Uç"[]"}  // Ungolfed
             // Implicit: U, V = input integers
VoX{      }  // Create the range [0...V) and replace each item X with
    Uç"[]"   //   U copies of the string "[]".
-R           // Join the result with newlines.
             // Implicit: output result of last expression

R, 70 bytes

p=paste
function(w,h)p(rep(p(rep('[]',w),collapse=''),h),collapse='
')

Try it online!

Returns an anonymous function that constructs and returns the string.

45 bytes, non-conforming

function(w,h)write(matrix('[]',w,h),'',w,,'')

An anonymous function that prints out the string in the desired format.

Try this online

Jelly, 7 bytes

ẋ⁾[]ẋ$Y

A dyadic link returning a list of characters (or a full program printing the result).

Try it online!

How?

ẋ⁾[]ẋ$Y - Main link: number w, number h          e.g. 2, 3
ẋ       - repeat w h times                            [2,2,2]
     $  - last two links as a monad:
 ⁾[]    -   literal ['[',']'],                        "[]"
    ẋ   -   repeat list (vectorises)                  ["[][]","[][]","[][]"]
      Y - join with newlines                          "[][]\n[][]\n[][]"
        - if a full program, implicit print

MATL, 7 bytes

v&DiiX"

Try it online!

Explanation

v    % Concatenate the (non-existing) stack contents: gives []
&D   % String representation: gives '[]'
ii   % Take two inputs
X"   % Repeat those numbers of times vertically and horizontally. Implicit display

05AB1E, 6 bytes

F„[]×,

Try it online!

Explanation

Input takes as height, width

F         # height times do
 „[]      # push "[]"
    ×     # repeat width times
     ,    # print with newline

Python 2.7, 32 bytes

Full program:

n,m=input()
exec"print'[]'*n;"*m

Try it online!

J, 12 bytes

'[]'$~],+:@[

Try it online!

Explanation

'[]'$~],+:@[   input: y, x
        +:@[   double y
      ],       pair with x
               this gives (x, 2y)
    $~         shape the left argument into the right argument's shape
'[]'           2-length character string

This gives us an x by 2y string of repeating [] characters.

SOGL, 5 bytes

Ƨ[]*∙

Simple:

Ƨ[]    push "[]"
   *   multiply horizontally (repeating width times)
    ∙  get an array with input (height) items of that
       implicitly output the array joined with newlines

Mathematica, 26 bytes

Grid@Table["[]",{#2},{#}]&