aboutsummaryrefslogtreecommitdiffstats
path: root/const.go
blob: 60bae20462937a2558d7cdcc68ce3339f48377dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
}