Skip to main content
Commonmark migration
Source Link

#Java 8, 100 84 78 bytes

Java 8, 100 84 78 bytes

a->b->{for(int i=0;;)System.out.println(a.split("\n")[i]+b.split("\n")[i++]);}

Exits with an ArrayIndexOutOfBoundsException to STDERR after it has printed the result to STDOUT, which is allowed.

-6 bytes thanks to @OlivierGrégoire.

Explanation:

Try it online.

a->b->{                        // Method with two String parameters and no return-type
  for(int i=0;;)               //  Loop over the substrings of the first input
    System.out.println(        //   Print:
     a.split("\n")[i]          //    The substring of the first input
     +b.split("\n")[i++]);}    //    plus the same-indexed substring of the second input

#Java 8, 100 84 78 bytes

a->b->{for(int i=0;;)System.out.println(a.split("\n")[i]+b.split("\n")[i++]);}

Exits with an ArrayIndexOutOfBoundsException to STDERR after it has printed the result to STDOUT, which is allowed.

-6 bytes thanks to @OlivierGrégoire.

Explanation:

Try it online.

a->b->{                        // Method with two String parameters and no return-type
  for(int i=0;;)               //  Loop over the substrings of the first input
    System.out.println(        //   Print:
     a.split("\n")[i]          //    The substring of the first input
     +b.split("\n")[i++]);}    //    plus the same-indexed substring of the second input

Java 8, 100 84 78 bytes

a->b->{for(int i=0;;)System.out.println(a.split("\n")[i]+b.split("\n")[i++]);}

Exits with an ArrayIndexOutOfBoundsException to STDERR after it has printed the result to STDOUT, which is allowed.

-6 bytes thanks to @OlivierGrégoire.

Explanation:

Try it online.

a->b->{                        // Method with two String parameters and no return-type
  for(int i=0;;)               //  Loop over the substrings of the first input
    System.out.println(        //   Print:
     a.split("\n")[i]          //    The substring of the first input
     +b.split("\n")[i++]);}    //    plus the same-indexed substring of the second input
added 183 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 8, 100 8484 78 bytes

a->b->{int i=0;forfor(Stringint t:a.split("\n")i=0;;)System.out.println(t+ba.split("\n")[i]+b.split("\n")[i++]);}

Try it online. Exits with an ArrayIndexOutOfBoundsException to STDERR after it has printed the result to STDOUT, which is allowed.

-6 bytes thanks to @OlivierGrégoire.

Explanation:

Try it online.

a->b->{                        // Method with two String parameters and no return-type
  for(int i=0;  i=0;;)               //  Loop over //the substrings Index-integer,of startingthe atfirst 0input
  for(String t:a System.splitout.println("\n"))  //  Loop over the substrings of// the first inputPrint:
    System.out a.printlnsplit(t"\n")[i]          //   Print thisThe substring of the first input
     +b.split("\n")[i++]);}    //    plus the same-indexed substring of the second input

#Java 8, 100 84 bytes

a->b->{int i=0;for(String t:a.split("\n"))System.out.println(t+b.split("\n")[i++]);}

Try it online.

Explanation:

a->b->{                        // Method with two String parameters and no return-type
  int i=0;                     //  Index-integer, starting at 0
  for(String t:a.split("\n"))  //  Loop over the substrings of the first input
    System.out.println(t       //   Print this substring
     +b.split("\n")[i++]);}    //   plus the same-indexed substring of the second input

#Java 8, 100 84 78 bytes

a->b->{for(int i=0;;)System.out.println(a.split("\n")[i]+b.split("\n")[i++]);}

Exits with an ArrayIndexOutOfBoundsException to STDERR after it has printed the result to STDOUT, which is allowed.

-6 bytes thanks to @OlivierGrégoire.

Explanation:

Try it online.

a->b->{                        // Method with two String parameters and no return-type
  for(int i=0;;)               //  Loop over the substrings of the first input
    System.out.println(        //   Print:
     a.split("\n")[i]          //    The substring of the first input
     +b.split("\n")[i++]);}    //    plus the same-indexed substring of the second input
deleted 534 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#Java 8, 100100 84 bytes

a->b->{for(int i=0;i<a.split("\n").length;System.out.printlni=0;for(String t:a.split("\n")[i]+b.split("\n")[i++]));}

Try it online.

Alternative of equal size (100 bytes):

a->b->{String[]t=a.split("\n");for(int i=0;i<t.length;SystemSystem.out.println(t[i]+bt+b.split("\n")[i++]));}

Try it online.Try it online.

Explanation:

a->b->{                        // Method with two String parameters and Stringno return-type
  for(int i=0;i<a.split("\n").length;
i=0;                     //  LoopIndex-integer, `n`starting times,at where0
 `n` isfor(String t:a.split("\n"))  //  Loop over the amountsubstrings of "\n"the first input
    System.out.println(a.split("\n")[i]+bt       //   Print this substring
     +b.split("\n")[i++]));}
         //   Print both substringsplus concattedthe withsame-indexed eachsubstring other,of plusthe asecond new-lineinput

#Java 8, 100 bytes

a->b->{for(int i=0;i<a.split("\n").length;System.out.println(a.split("\n")[i]+b.split("\n")[i++]));}

Try it online.

Alternative of equal size (100 bytes):

a->b->{String[]t=a.split("\n");for(int i=0;i<t.length;System.out.println(t[i]+b.split("\n")[i++]));}

Try it online.

Explanation:

a->b->{  // Method with two String parameters and String return-type
  for(int i=0;i<a.split("\n").length;
         //  Loop `n` times, where `n` is the amount of "\n"
    System.out.println(a.split("\n")[i]+b.split("\n")[i++]));}
         //   Print both substrings concatted with each other, plus a new-line

#Java 8, 100 84 bytes

a->b->{int i=0;for(String t:a.split("\n"))System.out.println(t+b.split("\n")[i++]);}

Try it online.

Explanation:

a->b->{                        // Method with two String parameters and no return-type
  int i=0;                     //  Index-integer, starting at 0
  for(String t:a.split("\n"))  //  Loop over the substrings of the first input
    System.out.println(t       //   Print this substring
     +b.split("\n")[i++]);}    //   plus the same-indexed substring of the second input
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading