Logo AG

Repeating constant with same value

Jan 25, 2021 - 1 minute read

If multiple constants have same value.

	const (
		min int = 1
		max int = 1
	)

Then the constant declaration can be simplified as below:

	// constants repeat the previous type and expression
	const (
		min int = 1
		max     // int = 1
	)
}