v icon indicating copy to clipboard operation
v copied to clipboard

constant name and variable name declaration ambiguity

Open ghost opened this issue 7 years ago • 2 comments

Compiler must not allow const and var names to be same or if const and var can have same name, a way to explicitly mention a const name should be allowed? ( example: const.AGE ? ).

The following program prints output: Age=20 AGE=30

AGE is a const name as well as a var name.

Program:

const (
	AGE = 40
)

fn main() {
	Age := 20
	AGE := 30
	println('Age=$Age')
	println('AGE=$AGE')
}

ghost avatar Jun 16 '19 20:06 ghost

Related: #265

chanbakjsd avatar Jun 25 '19 12:06 chanbakjsd

We'll use the other issue. By the way, we changed the way constants need to be capitalized. We now use PascalCasing.

Bowero avatar Jun 26 '19 19:06 Bowero