diff options
Diffstat (limited to 'const.go')
| -rw-r--r-- | const.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/const.go b/const.go new file mode 100644 index 0000000..60bae20 --- /dev/null +++ b/const.go @@ -0,0 +1,14 @@ +package main + +import "math" + +// parseConstant returns nil if s is not a valid constant. +func parseConstant(s string) *float64 { + switch s { + case "pi": + // Assign to variable because can't take address of constant. + var pi float64 = math.Pi + return &pi + } + return nil +} |