byValue-byName (simple)

Help Contents Examples byValue-byName (simple)
Butterfly (simple) CatDog (simple)

byValue-byName (simple)

This simple example shows the difference between call by value (with colon) and call by name (with quotation mark).

to byValue :x
	print :x "= :(:x)
end

to byName "x
	print :x "= :(:x)
end

make "a 100

byValue "a
byName  "a

to boza
	local "a
	make "a 10

	byValue "a
	byName  "a

	to koza :a
		byValue "a
		byName  "a
	end

	koza
	koza 1
end

boza

For the use of call by name see the example Pascal-Assignment (simple) !

Reference:

Butterfly (simple) CatDog (simple)