lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Soni L. once stated:
> Hello!
> 
> I'd like a way to do
> 
> local v
> do v = 3 end
> 
> without assigning nil to v.
> 
> Can we get expressionblocks?

  What, exactly, is wrong with

	local v
	do
	  v = 3
	end -- ?

  It works, even with additional local variables:

	local a,b,c
	do
	  a = 1
	  b = 2
	  c = a * somefunc(b) + someotherthing()
	end

  I use this pattern quite often in Lua.

  -spc (What, exactly, are you doing that require all these proposals you
	make?)