---
layout: docs
title: codegenConstant
id: interface.Facebook.HackCodegen.ICodegenFactory.codegenConstant
docid: interface.Facebook.HackCodegen.ICodegenFactory.codegenConstant
permalink: /docs/reference/interface.Facebook.HackCodegen.ICodegenFactory.codegenConstant/
---
# Facebook\\HackCodegen\\ICodegenFactory::codegenConstant()




Create a top-level constant (not a class constant)




``` Hack
public function codegenConstant(
  string $name,
): Facebook\HackCodegen\CodegenConstant;
```




## Parameters




+ ` string $name `




## Returns




* [` Facebook\HackCodegen\CodegenConstant `](<class.Facebook.HackCodegen.CodegenConstant.md>)