diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2023-07-23 12:24:32 -0230 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2023-07-23 12:24:32 -0230 |
| commit | 3951f8c09b3f49253cf0d354df708069223d0316 (patch) | |
| tree | 6392fad888bfde768008c83b58dd1575f6c87f9f /const.go | |
| parent | 4a585fba1ac08cd9f184627a4a8b781d0b52efcb (diff) | |
| download | pfc-3951f8c09b3f49253cf0d354df708069223d0316.zip | |
constant and function parsing skeleton
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 +} |