[Question]
  [
# Challenge description
In this challenge, we only consider `love` and `hate` as feelings. If we want to utter a **feeling expression** of order `N`, we alternate between these two (starting with `hate`):
```
order | expression
1       I hate it.
2       I hate that I love it.
3       I hate that I love that I hate it.
4       I hate that I love that I hate that I love it.
```
The pattern follows for every positive integer `N`. Given `N`, output the correspoinding feeling expression of order `N`.
# Notes
* Full stop (`.`) at the end of the expression is mandatory,
* Trailing and leading whitespaces (including newlines) are permitted,
* Output for a non-positive or non-integer `N` is undefined,
* This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") challenge, so make your code as short as possible!
  
[Answer]
# Python, 54 bytes
```
lambda n:("I hate that I love that "*n)[:12*n-5]+"it."
```
* Python 2: [Ideone it!](http://ideone.com/QApTy4)
* Python 3: [Ideone it!](http://ideone.com/Jo3Kap)
[Answer]
## [CJam](http://sourceforge.net/projects/cjam/), 36 bytes
```
ri{"hatlov"3/='IS@"e that "}/2<"it."
```
[Try it online!](http://cjam.tryitonline.net/#code=cml7ImhhdGxvdiIzLz0nSVNAImUgdGhhdCAifS8yPCJpdC4i&input=NA)
### Explanation
```
ri            e# Read input and convert to integer N.
{             e# For each i from 0 to N-1...
  "hatlov"3/  e#   Push ["hat" "lov"].
  =           e#   Use i as a cyclic index into this array to alternate between
              e#   "hat" and "lov".
  'IS         e#   Push character 'I' and a space.
  @           e#   Pull "hat" or "lov" on top of it.
  "e that "   e#   Push "e that "
}/
2<            e#   Truncate the last "e that " to just "e ".
"it."         e#   Push "it."
```
[Answer]
# C, ~~83~~ ~~76~~ ~~75~~ 74 bytes
*Thanks to @Leaky Nun for saving 11 bytes and adding 4 bytes!*  
*Thanks to @YSC for saving a byte!*
```
i;f(n){for(i=0;n--;)printf("I %se %s",i++%2?"lov":"hat",n?"that ":"it.");}
```
[Try it on Ideone](https://ideone.com/S5ql74)
[Answer]
## Javascript (ES6), ~~75~~ ~~73~~ 70 bytes
```
n=>[...Array(n)].map((_,i)=>i&1?'I love':'I hate').join` that `+' it.'
```
*Saved 2 bytes thanks to Neil*  
*Saved 3 bytes thanks to Whothehellisthat*
### Test
```
let f =
n=>[...Array(n)].map((_,i)=>i&1?'I love':'I hate').join` that `+' it.'
console.log(f(1))
console.log(f(2))
console.log(f(3))
console.log(f(4))
```
[Answer]
# Java 8, 91 bytes
```
i->{for(int j=0;j++<i;)System.out.printf("I %se %s",j%2>0?"hat":"lov",j<i?"that ":"it.");};
```
# Ungolfed Test Program
```
public static void main(String[] args) {
    Consumer<Integer> c = i -> {
        for (int j = 0; j++ < i;) {
            System.out.printf("I %se %s", j % 2 > 0 ? "hat" : "lov", j < i ? "that " : "it.");
        }
    };
    c.accept(1);
    c.accept(2);
    c.accept(3);
}
```
[Answer]
## Mathematica, 63 bytes
```
"I love"["I hate"][[#~Mod~2]]&~Array~#~Riffle~" that "<>" it."&
```
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), 25 bytes
```
“ṅɠT5“£ẏkg⁷»ṁj“¥ıQ»ṙ1“it.
```
[Try it online!](http://jelly.tryitonline.net/#code=4oCc4bmFyaBUNeKAnMKj4bqPa2figbfCu-G5gWrigJzCpcSxUcK74bmZMeKAnGl0Lg&input=&args=NA)
## Explanation
```
                             Input: n, a number.
“ṅɠT5“£ẏkg⁷»                 Compressed string array [' I hate', ' I love']
            ṁ                Cycle for n repetitions.
             j“¥ıQ»          Join by compressed string ' that'.
                   ṙ1        Rotate left once: move the initial space to the end.
                     “it.    Implicitly print the result, then print 'it.'
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~34~~ ~~32~~ 27 bytes
Saved 5 bytes thanks to [Adnan](https://codegolf.stackexchange.com/users/34388/adnan).
```
“I«¢€Š I„Î€Š “×¹12*5-£…it.«
```
**Explanation**
```
“I«¢€Š I„Î€Š “               # "I hate that I love that "
              ×              # repeat input nr of times
               ¹12*5-£       # take the first input*12-5 chars of string above
                      …it.«  # append "it."
                             # implicitly display
```
[Try it online!](http://05ab1e.tryitonline.net/#code=4oCcScKrwqLigqzFoCBJ4oCew47igqzFoCDigJzDl8K5MTIqNS3Co-KApml0LsKr&input=NA)
[Answer]
# R, 79 bytes
```
n=scan();for(i in n:1)cat(if((i+n)%%2)"I love"else"I hate",if(i>1)"that "else"it.")
```
Luckily in R, the default separator for `cat` is a space.
(Edited from original 73 byte version which didn't quite solve the problem.)
[Answer]
# [Retina](http://github.com/mbuettner/retina), ~~42~~ 38 bytes
Thanks to Leaky Nun for helping me golf it!
```
11
1I love n
1
I hate n
n$
it.
n
that 
```
Input is taken in unary.
[Try it online!](http://retina.tryitonline.net/#code=MTEKMUkgbG92ZSBuCjEKSSBoYXRlIG4KbiQKaXQuCm4KdGhhdCA&input=MTExMTE)
**Explanation**
```
11
1I love n
```
Replace every pair of `1`s with `1I love n`.
```
1
I hate n
```
Replace the remaining `1`s with `I hate n`.
```
n$
it.
n
that 
```
Replace the `n` at the end of the line with `it.` and every other n with `that`.
[Answer]
# Javascript (ES5), 99 94 bytes
```
function(c){for(d="",b=0;b<c;++b)d+=(b%2?"I love ":"I hate ")+(b==c-1?"it.":"that ");return d}
```
Saved 5 bytes thanks to Leaky Nun.
OLD 99 byte solution:
```
function(c){for(d="",b=0;b<c;++b)d+=(0==b%2?"I hate":"I love")+" "+(b==c-1?"it.":"that ");return d}
```
Another 98 byte solution:
```
function(d){for(c=[],b=0;b<d;++b)c.push(["love","hate"][b%2]);return"I "+c.join(" that I ")+" it"}
```
My code before minification:
```
function a(n){
  var hate="I hate",love="I love",it="it ",that="that ",out="";
  for(var i=0;i<n;++i){out+=(i%2==0?hate:love)+" "+(i==n-1?it+".":that)}return out;
}
```
[Answer]
# Haskell, 70 bytes
```
g 1="I hate";g n=g(n-1)++" that "++cycle["I love",g 1]!!n
(++" it.").g
```
[Answer]
## PowerShell v2+, 64 bytes
```
((1..$args[0]|%{('I love','I hate')[$_%2]})-join' that ')+' it.'
```
Rather straightforward. Loops from `1` up to the input `$args[0]`, each iteration placing either `'I love'` or `'I hate'` on the pipeline, based on a pseudo-ternary for modulo-2 (i.e., it alternates back and forth, starting with `'I hate'`). Those strings are encapsulated in parens and `-join`ed with `' that '` to smush them together, then string concatenation `' it.'` at the end.
### Test Cases
```
PS C:\Tools\Scripts\golfing> 1..5|%{.\hate-love-conundrum.ps1 $_}
I hate it.
I hate that I love it.
I hate that I love that I hate it.
I hate that I love that I hate that I love it.
I hate that I love that I hate that I love that I hate it.
```
[Answer]
# php, ~~64~~ 62 bytes
```
<?=str_pad("",$argv[1]*12-5,"I hate that I love that ")."it.";
```
Unfortunately I couldn't work out a way to avoid repeating the " that I ", or at least no way to do it in less than 7 bytes.
edit: saved 2 bytes thanks to @Jörg Hülsermann
[Answer]
## Perl, ~~62~~ ~~54~~ 50 bytes
```
$_="I xe tx "x$_;s/tx $/it./;s/x/++$.%4?hat:lov/ge
```
(credit to [@Ton Hospel](https://codegolf.stackexchange.com/users/51507/ton-hospel))
Demo: <http://ideone.com/zrM27p>
### Previous solutions:
```
$_="I xe that "x$_;s/x/$@++&1?lov:hat/ge;s/\w+.$/it./
```
(credit to [@Dada](https://codegolf.stackexchange.com/users/55508/dada))
Run with `perl -pE '$_="I xe that "x$_;s/x/$@++&1?lov:hat/ge;s/\w+.$/it./'`
### First solution (only this was mine)
```
for$x(1..<>){$_.=' I '.($x%2?hat:lov).'e that'}s/\w+$/it./;say
```
In parts:
```
for $x (1..<>) {
   $_ .= ' I '.($x % 2 ? hat : lov).'e that'
}
s/\w+$/it./;
say
```
Demo: <http://ideone.com/mosnVz>
[Answer]
# Bash + coreutils, 106 bytes:
```
for i in `seq $1`;{ printf "I %s %s " `((i%2>0))&&echo hate||echo love` `((i==$1))&&echo it.||echo that`;}
```
Simply creates a sequence starting at `1` up to and including the input integer using the `seq` built-in, and then iterates through it one by one, first outputting `hate` if the value of the iteration variable, `i`, is not divisible by `2` and `love` otherwise. In the same iteration, it then chooses to output `that` if `i` is not equal to the input value, and `it.` otherwise.
[Try It Online! (Ideone)](http://ideone.com/fdCFXy)
[Answer]
# ///, ~~60~~ 57 bytes
```
/!/I hate //T/that //
/it.//00/!TI love T//Tit./it.//0/!/
```
*-3 bytes thanks to m-chrzan*
Input in unary with trailing new line.
[Try it online!](http://slashes.tryitonline.net/#code=LyEvSSBoYXRlIC8vVC90aGF0IC8vCi9pdC4vLzAwLyFUSSBsb3ZlIFQvL1RpdC4vaXQuLy8wLyEvMDAwCg&input=)
[Answer]
## R, 92 90 bytes
An R adaptation of @Leaky Nun's python answer. Working with strings in R is tedious as always.
```
n=scan();cat(rep(strsplit("I hate that I love that ","")[[1]],n)[6:(n*12)-5],"it.",sep="")
```
This could probably be golfed further though.
Edit: saved 2 bytes by changing:
`[1:((n*12)-5)]`to `[6:(n*12)-5]`
[Answer]
## C, 96 Bytes
```
c;f(i){printf("I hate");for(;c<i+1/2-1;c++)printf(" that I %s",c&1?"hate":"love");puts(" it.");}
```
I didn't see the above solution from Releasing Helium Nuclei which is better.
[Answer]
# [MATL](http://github.com/lmendo/MATL), 37 bytes
```
:"2@o3]Qv'hate I that it. love'Ybw)Zc
```
[Try it online!](http://matl.tryitonline.net/#code=OiIyQG8zXVF2J2hhdGUgSSB0aGF0IGl0LiBsb3ZlJ1lidylaYw&input=NA)
### Explanation
The code is based on the following mapping from numbers to strings:
```
0: 'love'
1: 'hate'
2: 'I'
3: 'that'
4: 'it.'
```
The program pushes numbers to the string in groups of three: `2`, `0`, `3`; then `2`, `1`, `3`; then `2`, `0`, `3`; ... as many times as the input `n`. After that, the final `3` is transformed into a `4`, the mapping is applied to transform numbers to strings, and the strings are joined using space as separator.
```
:                         % Input n implicitly. Push range [1 2 ... n]
"                         % For each
  2                       %   Push 2
  @o                      %   Iteration index modulo 2: pushes 0 or 1
  3                       %   Push 3
]                         % End
Q                         % Add 1 to the last 3
v                         % Concatenate stack contents into a numeric column vector
'hate I that it. love'    % Push this string
Yb                        % Split at spaces. Gives a cell array of five strings
w                         % Swap to move numeric vector to top
)                         % Index cell array of strings with that vector. Indexing
                          % is 1-based and modular, so 0 refers to the last string.
                          % This gives a cell array of (repeated) strings
Zc                        % Join those strings by spaces. Display implicitly
```
[Answer]
# JavaScript (ES6), 68 bytes
```
f=(n,i)=>n?(i?' that I ':'I ')+(i&1?'love':'hate')+f(n-1,-~i):' it.'
document.write('<pre>'+[ 1, 2, 3, 4, 10, 100 ].map(c=>c+': '+f(c)).join`\n`);
```
[Answer]
# C#, ~~85~~ 83 bytes
```
string f(int n,int m=2)=>"I "+(1>m%2?"hat":"lov")+(m>n?"e it.":"e that "+f(n,m+1));
```
Recursively constructs the string, using an optional parameter to keep track of which hate/love and how many to append.
*-2 bytes from [this tip](https://codegolf.stackexchange.com/questions/173/tips-for-code-golfing-in-c/84382#84382) for checking the evenness/oddness of a number.*
### No optional parameter solution, ~~87~~ ~~86~~ 84 bytes
```
string h(int n)=>"I "+(0<n?"hat":"lov")+(2>n&-2<n?"e it.":"e that "+h(0<n?~n+2:~n));
```
This one does the same thing except determines which hate/love to append based on whether the parameter is positive or negative. Each iteration the parameter approaches zero, alternating sign.
[Answer]
# Thue, 100 bytes
```
@::=:::
>##::=>$.
$::=~I hate that I love 
>.#::=>&#
&::=~that 
>#<::=~I hate it.
>.<::=~it.
::=
>@<
```
Takes input as unary. (A string of n `#`s)
[Answer]
## Pyke, 36 bytes
```
2/"I hate ""I love "]*"that "J"it."+
```
[Try it here!](http://pyke.catbus.co.uk/?code=2%2F%22I+hate+%22%22I+love+%22%5D%2a%22that+%22J%22it.%22%2B&input=3)
```
2/                                   -    input/2
                     *               -   ^ * v
  "I hate ""I love "]                -    ["I hate ", "I love "]
                      "that "J       -  "that ".join(^)
                              "it."+ - ^+"it."
```
Also 36 bytes
```
12*5+.daෆ   ű   l5d+12"I ":Q*<"it."+
```
[Try it here!](http://pyke.catbus.co.uk/?code=12%2a5%2B.d%05a%E0%B7%86%09%C5%B1%09l5d%2B12%22I+%22%3AQ%2a%3C%22it.%22%2B&input=4) (Link uses `X` instead of `I`, [this](http://pyke.catbus.co.uk/?code=12*5%2B.d%05%0A%E0%B7%86%09%C5%B1%09l5d%2B12%22I+%22%3AQ*%3C%22it.%22%2B&input=4) should work for the same amount of bytes offline where you can literally use those bytes. Online `\r` gets automatically replaced with `\n`)
[Answer]
# ><> (Fish), 82 Bytes
```
' I'oov.2coo<;oooo' it.'<
'ahv'v>'et'
oop26<^ooooo^o' that I '^!?:-1oo
'ol^'^>'ev'
```
Doubt it's very efficient, but it seems to more or less work. Input is via the starting stack, which makes the score 85 Bytes if you include the size of the `-v` argument required to do so.
[Try it online!](https://fishlanguage.com/playground/JTWzGWskTR7KWfoz3)
[Answer]
# Lua , 75 Bytes
```
n=io.read();print(('I hate that I love that '):rep(n):sub(1,n*12-5)..'it.')
```
[Answer]
# [///](http://esolangs.org/wiki////), 68 bytes
```
/@/1\/#love //%/hate//#/that I //%1i/% i//I %1/I % //1@#% //@/I %1it.
```
Input in unary - add more `1`s in the last section. 
[Try it online!](http://slashes.tryitonline.net/#code=L0AvMVwvI2xvdmUgLy8lL2hhdGUvLyMvdGhhdCBJIC8vJTFpLyUgaS8vSSAlMS9JICUgLy8xQCMlIC8vQC9JICUxMTExMWl0Lg&input=)
[Answer]
## dc, 75 bytes
```
?[1-lbP[I lov]P]sa[e that ]sb[[e it.]Pq]sc[1-[I hat]Pd2%1=ad1>clbPlxx]dsxx
```
We're really just printing one chunk of string at a time here, and not leaving any garbage on the stack. This is great, we don't need to waste any bytes dealing with a register for our counter.
```
?                              #Input, works as our decrement counter
[1-lbP[I lov]P]sa              #Macro 'a' decrements our counter, prints string 'b', 
                               #then prints 'I lov'
[e that ]sb                    #String 'b'
[[e it.]Pq]sc                  #Macro 'c' prints the tail end of our message and quits
[1-                            #I'll unfold our main macro here; first step is to 
                               #decrement our counter
   [I hat]P                    #We always start by hating 'it,' no conditional needed
           d2%1=a              #Check the oddness of our counter; execute 'a' if odd
                 d1>c          #Check our counter; If we're done, execute 'c'
                     lbPlxx]   #Otherwise, print 'b' again and start this macro ('x') over
dsxx                           #Stores the above macro as 'x' and runs it.
```
[Answer]
## Julia, 91 Bytes
Thought I add a julia solution:
```
f(N)=string("I hate ",join(["that I love that I hate " for _ in 1:N-1])[1:12*(N-1)],"it."))
```
]