• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Parameters
2==========
3
4Declare parameters on methods and constructors with either `ParameterSpec.builder()` or
5`FunSpec`'s convenient `addParameter()` API:
6
7```kotlin
8val android = ParameterSpec.builder("android", String::class)
9  .defaultValue("\"pie\"")
10  .build()
11
12val welcomeOverlords = FunSpec.builder("welcomeOverlords")
13  .addParameter(android)
14  .addParameter("robot", String::class)
15  .build()
16```
17
18The code above generates:
19
20```kotlin
21fun welcomeOverlords(android: String = "pie", robot: String) {
22}
23```
24
25The extended `Builder` form is necessary when the parameter has annotations (such as `@Inject`).
26