[Question]
  [
There was [a challenge](https://codegolf.stackexchange.com/questions/125470/multiply-two-strings) up a while ago about multiplying strings. It showed us how we can multiply not only numbers, but also strings. However, we still can't multiply a number by a string properly. There has been [one attempt](https://codegolf.stackexchange.com/questions/71427/decimal-multiplication-of-strings) to do so but this is obviously wrong. We need to fix that!
## Your Task:
Write a function or program that multiplies two inputs, a string and an integer. To (properly) multiply an string by an integer, you split the string into characters, repeat each character a number of times equal to the integer, and then stick the characters back together. If the integer is negative, we use its absolute value in the first step, and then reverse the string. If the input is 0, output nothing (anything multiplied by 0 equals nothing). 
## Input:
A string that consists solely of printable ASCII characters and newlines, and an integer (possible negative). 
## Output:
The string multiplied by the integer. 
## Examples:
```
Hello World!, 3            --> HHHeeellllllooo   WWWooorrrlllddd!!!
foo, 12                    --> ffffffffffffoooooooooooooooooooooooo
String, -3                 --> gggnnniiirrrtttSSS
This is a fun challenge, 0 --> 
Hello
World!, 2                  --> HHeelllloo
                               WWoorrlldd!!
```
## Scoring:
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), lowest byte count wins!
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~6~~ ~~5~~ 4 bytes
```
¬≤∆ìxm
```
[Try it online!](https://tio.run/##y0rNyan8///QpmOTK3L/H25/1LQm61HDnEPbdEHg0Lb/6h5AFfkK4flFOSmK6lzqafn5QDK4pCgzLx3ICMnILFYAokSFtNI8heSMxJyc1Lz0VKAMWF9MHlTjf2MdBUMjHQVdIG2go2AEAA "Jelly ‚Äì Try It Online")
### How it works
```
¬≤∆ìxm  Main link. Argument: n (integer)
¬≤     Yield n¬≤.
 ∆ì    Read and eval one line of input. This yields a string s.
  x   Repeat the characters of s in-place, each one n¬≤ times.
   m  Takes each |n|-th character of the result, starting with the first if n > 0, 
      the last if n < 0.
```
[Answer]
## JavaScript (ES6), 63 bytes
Takes input in currying syntax `(s)(n)`.
```
s=>n=>[...s].reduce((s,c)=>n<0?c.repeat(-n)+s:s+c.repeat(n),'')
```
### Test cases
```
let f =
s=>n=>[...s].reduce((s,c)=>n<0?c.repeat(-n)+s:s+c.repeat(n),'')
console.log(f(`Hello World!`)(3))
console.log(f(`foo`)(12))
console.log(f(`String`)(-3))
console.log(f(`This is a fun challenge`)(0))
console.log(f(`Hello
World!`)(2))
```
[Answer]
# [Python 3](https://docs.python.org/3/), 44 bytes
```
f=lambda s,n:s and s[0]*n+f(s[1:],n)+s[0]*-n
```
[Try it online!](https://tio.run/##PU49D4IwEP0r59RWiuFjI2F318QBGKq0UFOvhOLgr69nNV5ueF95ectrmz3WMZrWqcd1VBAkNgEUjhC6YthjZnjoymaQKLKk5BiX1eLGWY/553pkh7u3yCkpAQUYv8IPWoSOs6N2zku4@NWNOyahFhI4M94TLqtETht1TsTzr3mebQB6BeaJcJuVcxonTYEi@amyx39lJQbSNc1ugTER3w "Python 3 ‚Äì Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~59~~ ~~57~~ ~~50~~ 46 bytes
*-2 bytes thanks to Anders Kaseorg. -4 bytes thanks to Dennis.*
```
lambda s,n:''.join(i*n**2for i in s)[::n or 1]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUaFYJ89KXV0vKz8zTyNTK09Lyygtv0ghUyEzT6FYM9rKKk8ByDWM/V9QlJlXopCmoe6RmpOTr6MQnl@Uk6KorqNgrMkFlwsuAbLSgYK6xpr/AQ "Python 2 ‚Äì Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 10 bytes
```
S¬≤√Ñ√óJ¬≤0‚ÄπiR
```
[Try it online!](https://tio.run/##MzBNTDJM/f8/@NCmwy2Hp3sd2mTwqGFnZtD//0pKSh6pOTn5XOH5RTkpikAul64RAA "05AB1E ‚Äì Try It Online")
```
S          # Split the string into characters
 ¬≤√Ñ√ó       # Repeat each character abs(integer) times
    J      # Join into a string
     ¬≤0‚Äπi  # If the integer is less than 0...
         R #   Reverse the string
```
[Answer]
## R, ~~83~~ ~~78~~ ~~76~~ 74 bytes
```
function(s,i)cat('if'(i<0,rev,I)(rep(el(strsplit(s,'')),e=abs(i))),sep='')
```
Anonymous function.
Frederic saved 3 bytes, Giuseppe saved ~~2~~ 4, pajonk saved 2.
Explanation:
```
     el(strsplit(s,''))                      # split string into list characters
 rep(                  ,e=abs(i)))           # repeat each character abs(i) times
    'if'(i<0,rev, ){...}                     # if i>0, reverse character list
                 I                           # otherwise leave it alone: I is the identity function
cat(                    ,sep='')             # print the result
```
Tests:
```
> f('Hello World!', 3 )
HHHeeellllllooo   WWWooorrrlllddd!!!
> f('foo', 12)
ffffffffffffoooooooooooooooooooooooo
> f('String', -3)
gggnnniiirrrtttSSS
> f('This is a fun challenge', 0)
> f('Hello
+ World!', 2)
HHeelllloo
WWoorrlldd!!
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 9 bytes
```
y|Y"w0<?P
```
Inputs are: number, then string.
Strings with newlines are input using char `10` as follows: `['first line' 10 'second line']`.
[Try it online!](https://tio.run/##y00syfn/v7ImUqncwMY@4P9/XWMu9eCSosy8dHUA "MATL ‚Äì Try It Online") Or [verify all test cases](https://tio.run/##y00syfmf8L@yJlKp3MDGPuB/rEvIf2MudY/UnJx8hfD8opwURXUFLkMjLvW0/Hx1Ll2gXHBJUWZeujqXAZd6SEZmsQIQJSqkleYpJGck5uSk5qWnqnMZcUVDzFBXMDRQUIcaFKsAAA).
### Explanation
Consider inputs `-3` and `'String'`.
```
y      % Implicitly take two inputs. Duplicate from below
       % STACK: -3, 'String', -3
|      % Absolute value
       % STACK: -3, 'String', 3
Y"     % Run-length decoding
       % STACK: -3, 'SSStttrrriiinnnggg'
w      % Swap
       % STACK: 'SSStttrrriiinnnggg', -3
0<     % Less than 0?
       % STACK: 'SSStttrrriiinnnggg', 1
?      % If so
  P    %   Flip
       %   STACK: 'gggnnniiirrrtttSSS'
       % End (implicit). Display (implicit)
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~41~~ 36 bytes
```
f n|n<0=reverse.f(-n)|1<3=(<*[1..n])
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hrybPxsC2KLUstag4VS9NQzdPs8bQxthWw0Yr2lBPLy9W839uYmaegq1CSj6XgkJBUWZeiYKKQpqCkYJSYlJyihKKoIaukSY2cQOo4H8A "Haskell ‚Äì Try It Online")
Example usage: `f (-3) "abc"` yields `"cccbbbaaa"`.
**Edit:** -5 bytes thanks to xnor!
[Answer]
# [V](https://github.com/DJMcMayhem/V), ~~29, 23, 18~~, 17 bytes
```
√¶_√±√Äu√±√ì./&√≤
√Ä√§√´√ç√Æ
```
[Try it online!](https://tio.run/##K/v///Cy@MMbDzeUAonJevpqhzdxHW44vOTw6sO9h9f9/@@RmpOTr1CeX5STovhfV/e/rjEA "V ‚Äì Try It Online")
Hexdump:
```
00000000: e65f f1c0 75f1 d32e 2f26 f20a c0e4 ebcd  ._..u.../&......
00000010: ee                                       .
```
Thanks to @nmjcman101 for saving 6 bytes, which encouraged me to save another 5!
The original revision was pretty terrible, but now I'm really proud of this answer because it handles negative numbers surprisingly well. (V has next to no numerical support and no support for negative numbers)
Explanation:
```
√¶_          " Reverse the input
  √±  √±      " In a macro:
   √Ä        "   Run the arg input. If it's positive it'll give a count. If it's negative
            "   running the '-' will cause V to go up a line which will fail since we're
            "   on the first line, which will break out of this macro
    u       "   (if arg is positive) Undo the last command (un-reverse the line)
      √ì./&√≤ " Put every character on it's own line
```
At this point, the buffer looks like this:
```
H
e
l
l
o
w
o
r
l
d
!
<cursor>
```
It's important to not the trailing newline, and that the cursor is on it.
```
√Ä           " Run arg again. If it's negative, we will move up a line, and then give the 
            " absolute value of the count. If it's positive (or 0) it'll just give the
            " count directly (staying on the last line)
 √§          " Duplicate... (count times)
  √´         "   This column. 
   √ç√Æ       " Remove all newlines.
```
[Answer]
# [J](http://jsoftware.com/), 19 15 13 bytes
```
(#~|)A.~0-@>]
```
[Try it online!](https://tio.run/##y/r/X0NDua5G01GvzkDXwS5W8/9/9eCSosy8dHUFNBkFYy6cUga4peKNAQ "J ‚Äì Try It Online")
**Explanation**
```
        0-@>]      NB. first or last index depending on sign of right arg
     A.~           NB. get first or last Anagram of left arg
(#~|)              NB. copy left arg, absolute-value-of-right-arg times
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 10 bytes
```
0‚ÄπFR} í¬π√Ñ√ó?
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f4FHDTreg2lOTDu083HJ4uv3//7qmXEpKSh6pOTn5XOH5RTkpikAuAA "05AB1E ‚Äì Try It Online")
**Explanation**
```
0‚ÄπF         # input_1 < 0 times do:
   R        # reverse input_2
    }       # end loop
      í      # filter
      ¬π√Ñ√ó   # repeat current char abs(input_1) times
         ?  # print without newline
```
[Answer]
# PHP>=7.1, 65 bytes
```
for([,$s,$n]=$argv;$i<strlen($s)*abs($n);)echo$s[$i++/$n-($n<0)];
```
[PHP Sandbox Online](http://sandbox.onlinephpfunctions.com/code/3dc97c84fcc3abd76c0d3cdb949c5a31dbc1a326)
[Answer]
# [Brain-Flak (BrainHack)](https://github.com/Flakheads/BrainHack), ~~154~~ 152 bytes
```
([(({})(<()>))]<>)<>{({}()<([{}]()<([{}])>)<>({}<>)<>>)<>}{}<>{}<>({}<([][()]){{}({<({}<(({}<>)<>)>())>[()]}<{}{}>)([][()])}{}{}<>>){{}{({}<>)<>}(<>)}{}
```
[Try it online!](https://tio.run/##NYyxCsNADEP/JZM0ZMxmDP2GjscNaYc2FDKEbMbf7toHNwiZJ8mvaz/O7/7@RaAB5oSASnZRiloSUNDM@3RWkHwUSl53qSBab2Cn5dBkkNmlgtRKXSxHyll2Gz@0VjbrjrTkEbE@Yt1ied7XcX6WPw "Brain-Flak (BrainHack) ‚Äì Try It Online")
Just here to give DJMcMayhem some competition. **;)**
## Explanation
Here's a modified version of DJMcMayhem's explanation
```
#Compute the sign and negative absolute value 
([(({})<(())>)]<>)<>{({}()<([{}]()<([{}])>)<>({}<>)<>>)<>}{}<>{}<>
#Keep track of the sign
({}<
    #For each char in the input string:
    ([][()])
    {
        {}
        #Push n copies to the alternate stack
        ({<({}<(({}<>)<>)>())>[()]}<{}{}>)
        #Endwhile
        ([][()])
    }{}{}<>
#Push the sign back on
>)
#If so...
{{}
    #Reverse the whole stack
    {({}<>)<>}
    #And toggle over, ending the loop
    (<>)
}
#Pop the counter off
{}
```
[Answer]
# [Elm](https://elm-lang.org/), 69 bytes
```
f n=if n<0 then List.reverse>>f -n else List.concatMap(List.repeat n)
```
Defines `f` to be a function that takes an integer and a list of characters and returns a list of characters. You can try it [here](https://elm-lang.org/try). Here is a full test program:
```
import Html exposing (text)
f : Int -> List Char -> List Char
f n=if n<0 then List.reverse>>f -n else List.concatMap(List.repeat n)
main =
  text (String.fromList (f -3 ['S','t','r','i','n','g']))
```
### Explanation
This is my first Elm submission, so please let me know any golfing tricks I've missed.
Using currying, we define a function `f` that takes an integer `n` and returns a function from a list of chars to a list of chars. There are two cases in the function definition:
* If `n` is negative, call `f` on its absolute value (`f -n`); then compose (`>>`) the resulting function with `List.reverse`.
* Else, create a function that puts `n` copies of a value in a list (`List.repeat n`) and map that function over each char in the list, flattening the result into a list of chars (`List.concatMap`).
[Answer]
# Dyalog APL, 15 bytes
```
{‚åΩ‚ç£(‚çµ<0)‚ä¢‚ç∫/‚ç®|‚çµ}
```
String as a left argument, number as a right argument.
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v8/7VHbhOpHPXsf9S7WeNS71cZA81HXoke9u/Qf9a6oAQrU/v@v7pGak5OvEJ5flJOiqK6QpmDMpZ6Wnw9iGRpxqQeXFGXmpYN4h9YDZUIyMosVgChRIa00TyE5IzEnJzUvPRUkbwAA)
**How?**
`‚ç∫/‚ç®` - repeat the string
`|‚çµ` - abs(number) times
`‚åΩ‚ç£` - reverse if
`(‚çµ<0)` - the number is below 0
[Answer]
# MATLAB, 37 bytes
```
@(s,n)flip(repelem(s,abs(n)),(n<0)+1)
```
This defines and anonymous function with inputs `s`: string and `n`: number.
Example runs:
```
>> @(s,n)flip(repelem(s,abs(n)),(n<0)+1)
ans = 
    @(s,n)flip(repelem(s,abs(n)),(n<0)+1)
>> f = ans;
>> f('String', 3)
ans =
SSStttrrriiinnnggg
>> f('String', -3)
ans =
gggnnniiirrrtttSSS
>> f('String', 0)
ans =
   Empty matrix: 1-by-0
```
[Answer]
# [Brain-Flak (Haskell)](https://github.com/Flakheads/BrainHack), ~~202~~ 192 bytes
```
(({})<(([({})]<>)){({}()<([{}])<>({}<>)<>>)<>}{}([{}]<><{}>)([][()]){{}({<({}<(({}<>)<>)>[()])>()}<{}{}>)([][()])}{}{}<>>)([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}{{}{({}<>)<>}(<>)}{}
```
[Try it online!](https://tio.run/##TY2xDsJADEP/pZM9dGKNIvENjKcbCgNUSB2qblG@PSQHCIbo4hf7fN2XdXsst2cEYE4BWr1dlLTckKiZd4qmSipa43kpLCrmSrTewE5LbFJGfN3UcVHQ0/pv9pL13ajMBKns@DW/ewwYHanMRyJZ4U@BVyJ5RMznOMV0OfZ1u08v "Brain-Flak (BrainHack) ‚Äì Try It Online")
This is probably the worst possible language to do it in, but it's done. Thanks to @Wheatwizard for providing the Haskell interpreter, which allows mixed input formats. This would be about 150 bytes longer without it.
Explanation:
```
#Keep track of the first input (n)
(({})<
    #Push abs(n) (thanks WheatWizard!)
    (([({})]<>)){({}()<([{}])<>({}<>)<>>)<>}{}([{}]<><{}>)
    #For each char in the input string:
    ([][()])
    {
        {}
        #Push n copies to the alternate stack
        ({<({}<(({}<>)<>)>[()])>()}<{}{}>)
        #Endwhile
        ([][()])
    }{}{}<>
#Push the original n back on
>)
#Push n >= 0
([({}<(())>)](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}
#If so...
{{}
    #Reverse the whole stack
    {({}<>)<>}
    #And toggle over, ending the loop
    (<>)
}
#Pop the counter off
{}
```
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), ~~99~~ ~~98~~ ~~89~~ ~~87~~ 85 bytes
```
s->n->{for(int i=s.length*(n<0?n:-n),r=n<0?0:~i;i++<0;)System.out.print(s[(i+r)/n]);}
```
[Try it online!](https://tio.run/##XVDLbsIwELzzFVtONhA3tDcCVBVS1R6qHqjUQ5qDCQ6YOnZkb5AQSn89dR4gVMmyrZnVzOwc@JEHphD6sP2pZV4Yi3DwGCtRKpaVOkVpNBtFg6LcKJlCqrhz8M6lhvMAoEcdcvTP0cgt5J4ja7RS7@IEuN052o4CvPRy83TPbZxM3jSujHZlLuwSMljULljqYHnOjCVSI8iFY0roHe5HRM/DJz0LNJ3YRfMPZ78ykuPxPIzo@uRQ5MyUyApvi8TFRI4tvdcJjao6as0/NgeRYpz4TCgcOlj0qQDOw1ehlIEvY9X2bjiBx2pypTJjPDJ9uIE@99KBPxx8QeCXUU1K4cfCm6muAg8Gt3Kt07e@Wl10qy5ls/olaZtz1qWl17AZ40WhToT0HdOGj8OEMjQr3@uztfxEKGU8TUWBhPiWxU7Ybm7qG@mF/remNOm5ajBorqr@Aw "Java (OpenJDK 8) ‚Äì Try It Online")
* -2 bytes thanks to @Xanderhall
* -2 bytes thanks to @Nevay
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~108~~ ~~106~~ ~~103~~ 101 bytes
-2 bytes thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)
```
e,p,j,d;f(s,i)char*s;{p=0,e=strlen(s);for(i*=d=i<0?p=e-1,e=-1:1;p^e;p+=d)for(j=i;j--;)putchar(s[p]);}
```
[Try it online!](https://tio.run/##ZY8/D4IwEMVn@RSVqcU2Ad08G1d3TRz8kxBooaS2TQsT4bNjdTAxJDfd@7279yrWVNU8C@poR2uQOFBFqrb0WYDR8ZwKHnqvhcGBgLQeq4zXXB3yo@OCFVFmxb4A9xTgNrwmH6TjCjrGgLih/5zC4eYeBKZZmR69SmUwScZVspI4PQmtLbpar@t1StGOAIqmgNOUwBeQ1sZ9sV0I594r00SNLU2XVgUUp0RyMChG0LFAIyKcL9hvgrv5Rfj/NM1v "C (gcc) ‚Äì Try It Online")
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 49 bytes
```
@(s,n){t=repmat(s,abs(n),1)(:)',flip(t)}{2-(n>0)}
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo1gnT7O6xLYotSA3sQTIS0wq1sjT1DHU1LDSVNdJy8ks0CjRrK020tXIszPQrP2fpqHukZqTk6@uY6zJheAYIHN0jTX/AwA "Octave ‚Äì Try It Online")
I will provide an explanation tomorrow.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 59 +1 = 60 bytes
Uses `-n` flag.
```
n=eval$_
a=$<.read
a.reverse!if n<0
a.chars{|i|$><<i*n.abs}
```
[Try it online!](https://tio.run/##DcjBCkBAEADQ@34FtSch5bqc/YGjBiNb26xm2RJ@3XB69fgYTxFqMILTg4JGm5IRZgU/ETlgapeETPXHtAKH67a3bo2xGZUwhkekqFWHzvlc9Z7dnL5@262nIAV9 "Ruby ‚Äì Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 16 bytes
```
Ôº¶Œ∏¬ø‚ÄπŒ∑0Ôº¶¬±Ôº©Œ∑‚ÜêŒπÔº¶Ôº©Œ∑Œπ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z8tv0hBo1BTITNNQcMntbhYI0NHQclASVNTASzjl5qeWJKq4ZxYXKKRoQkUDSjKzCvRsPJJTSvRUcjUVEjNKU6FKIWpgSrJ1LT@/z@4BMhO59I1/q9b9l@3OAcA "Charcoal ‚Äì Try It Online") Link is to verbose version of code. Explanation:
```
Ôº¶Œ∏              For each character in the input string
  ¬ø‚ÄπŒ∑0          If the input number is less than zero
      Ôº¶¬±Ôº©Œ∑      Repeat the negation of the input number times
          ‚ÜêŒπ    Print the character leftwards (i.e. reversed)
      Ôº¶Ôº©Œ∑       Otherwise repeat the input number times
         Œπ      Print the character
```
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 9 bytes
```
q~__*@e*%
```
[Try it online!](https://tio.run/##S85KzP3/v7AuPl7LIVVL9f9/peCSosy8dCUFXWMA "CJam ‚Äì Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 12 bytes
```
¬ÆpVa√É¬¨r!+sVg
```
[Try it online!](http://ethproductions.github.io/japt/?v=1.4.5&code=rnBWYcOsciErc1Zn&input=IkhlbGxvCldvcmxkISIgMg==)
## Explanation
Implicit input of string `U` and integer `V`.
```
¬ÆpVa√É
```
Map (`¬Æ`) each letter of `U` (implicitly) to itself repeated (`p`) `abs(V)` (`Va`) times.
```
¬¨r
```
Turn the string into an array of chars (`¬¨`) and reduce (`r`) that with...
```
!+sVg
```
`"!+".slice(sign(V))` - this either reduces with `+` ‚Üí `a + b`, or with `!+` ‚Üí `b + a`.  
[Thanks @Arnauld for the backwards-reduce idea!](https://codegolf.stackexchange.com/a/132008/69583)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
Based off Riley's approach.
```
S√Ç√é‚Ä∫@¬≤√Ñ√óJ
```
[Try it online!](https://tio.run/##MzBNTDJM/f8/@HDT4b5HDbscDm063HJ4utf//x6pOTn5Ogrh@UU5KYpcusYA "05AB1E ‚Äì Try It Online")
### Explanation
```
S√Ç√é‚Ä∫@¬≤√Ñ√óJ   Arguments: s, n
S           Push s split into individual characters
 √Ç          Get a (without popping) and push a reversed
  √é‚Ä∫        n lower than 0 (true = 1, false = 0)
    @       Get value at that index in the stack
     ¬≤√Ñ√óJ   Repeat each character abs(n) times and join
            Implicit output
```
[Answer]
# [WendyScript](http://felixguo.me/wendy/), 46 bytes
```
<<f=>(s,x){<<n=""#i:s#j:0->x?x>0n+=i:n=i+n/>n}
f("Hello World", -2) // returns ddllrrooWW  oolllleeHH
```
[Try it online!](http://felixguo.me/#wendyScript)
## Explanation (Ungolfed):
```
let f => (s, x) {
  let n = ""
  for i : s
    for j : 0->x
      if x > 0 n += i
      else n = i + n
  ret n
}
```
[Answer]
# C89 bytes
```
main(int c,char**v){for(;*v[1];v[1]++)for(c=atoi(v[2]+(*v[2]=='-'));c--;)putchar(*v[1]);}
```
I saw [Ben Perlin's version](https://codegolf.stackexchange.com/a/132050/22873) and wondered if you couldn't be shorter still and also have a full program; surely, `atoi()` and `putchar()` aren't that expensive in terms of bytes? Seems I was right!
[Answer]
# Pyth, ~~13~~ 11 bytes
```
*sm*.aQdz._
```
[Try it!](https://pyth.herokuapp.com/?code=%2asm%2a.aQdz._&input=-3%0AHello+World%21&test_suite=1&test_suite_input=-3%0AHello+World%21%0A3%0AHello+World%21%0A0%0AHello+World%21&debug=0&input_size=2)
*-2 bytes thanks to @jacoblaw*
## explanation
```
*sm*.aQdz._   
  m     z     # map onto the input string (lambda var: d)
   *.aQd      # repeat the char d as often as the absolute value of the input number 
 s            # sum the list of strings into a single string
*        ._Q   # Multiply with the sign of the implicit input value: reverse for negative Q 
```
## old approach, 13 bytes
```
_W<Q0sm*.aQdz
```
[Try it!](https://pyth.herokuapp.com/?code=_W%3CQ0sm%2a.aQdz&input=-3%0AHello+World%21&test_suite=1&test_suite_input=-3%0AHello+World%21%0A3%0AHello+World%21%0A0%0AHello+World%21&debug=0&input_size=2)
[Answer]
# [Python 3](https://docs.python.org/3/), 68 bytes
```
h=lambda s,n:h(s[::-1],-n)if n<0 else s[0]*n+h(s[1:],n)if s else s*n
```
[Try it online!](https://tio.run/##K6gsycjPM/7/P8M2JzE3KSVRoVgnzypDozjaykrXMFZHN09TITNNIc/GQCE1pzhVoTjaIFYrTxukwNAqVgciWwyV08r7X1CUmVeikaGhnpGak5OvrmOiqckFF0vPz09JqkxV1zHDKqoLFP4PAA "Python 3 ‚Äì Try It Online")
[Answer]
# Excel VBA, ~~93~~ ~~89~~ ~~88~~ ~~86~~ 85 Bytes
Anonymous VBE immediate window function that takes input as string from cell `[A1]` and int from cell `[B1]` and outputs to the VBE immediate window
```
l=[Len(A1)]:For i=1To l:For j=1To[Abs(B1)]:?Mid([A1],IIf([B1]>0,i,l+1-i),1);:Next j,i
```
-4 bytes for abandoning `[C1]` as intermediate variable
-1 byte for adding `a` as intermediate variable
-2 bytes for replacing `a` with `l`, (`[Len(A1)]`)
]