Skip to content

Commit 2852c9b

Browse files
committed
Better shorthand for units
1 parent 55609db commit 2852c9b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fantasy-docs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ This is an expression which evaluates `can_of_beans` with its two input paramete
296296
Some units have aliases, so you could also write
297297

298298
```kcl
299-
can_of_beans(Cm(10), Ft(1))
299+
can_of_beans(10.Cm, 1.Ft)
300300
```
301301

302302
See the [docs](units) for all units and aliases.
@@ -386,10 +386,10 @@ You pass keyword arguments like this:
386386

387387
```kcl
388388
/// Using a keyword argument.
389-
sphere(Distance::metre(1), material = Plastic.ISO1234)
389+
sphere(1.Metre, material = Plastic.ISO1234)
390390
391391
/// Or, don't use a keyword argument and rely on the default.
392-
sphere(Distance::metre(1))
392+
sphere(1.Metre)
393393
```
394394

395395
Keyword arguments help keep your KCL programs readable, and allows us to add new features to the standard library in a backwards-compatible way. Suppose that KittyCAD releases KCL 1.4, which adds a new positional argument to a standard library function `sphere`. Any programs using the definition of `sphere` from KCL 1.3 would stop compiling when you upgrade to 1.4 (because they're missing a parameter to `sphere`). But if we add the new parameter as a _keyword parameter_, your existing programs will keep working -- they'll just use the default value for that parameter.

0 commit comments

Comments
 (0)