---
layout: docs
title: addLineIf
id: class.Facebook.HackCodegen.BaseCodeBuilder.addLineIf
docid: class.Facebook.HackCodegen.BaseCodeBuilder.addLineIf
permalink: /docs/reference/class.Facebook.HackCodegen.BaseCodeBuilder.addLineIf/
---
# Facebook\\HackCodegen\\BaseCodeBuilder::addLineIf()




If the condition is true, append the code followed by a newline




``` Hack
final public function addLineIf(
  bool $condition,
  string $code,
): this;
```




## Parameters




+ ` bool $condition `
+ ` string $code `




## Returns




* ` this `