Question: Define an ocaml function, called print_checkerboard, that takes two inputs: num_rows and num_cols. It should print out a checkerboard pattern of Xs and underscores, separated
Define an ocaml function, called print_checkerboard, that takes two inputs: num_rows and num_cols. It should print out a checkerboard pattern of Xs and underscores, separated by spaces, having num_rows and num_cols, as illustrated below.
# print_checkerboard "X" "_" 4 3;; X _ X _ X _ X _ X _ X _ - : unit = ()
# print_checkerboard "X" "O" 3 4;; X O X O O X O X X O X O
- : unit = ()
Hint: Use print_alternating to print a single row, then make an appropriate recursive function call.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
