by Sharlin · 10y ago · 0 comments
var = []
var = 2For the array I do a little hackery. You can define the array without an initial value in the container and I can guess the value type.
arr = []
arr.append(1)
it will spit out std::vector<decltype(1)> arr{};
arr.push_back(1); auto var = // this type can't be inferred because it's not used
{
auto var = 2;
}
I'm too exhausted to think why this may not be applicable. x = 2
if stringy: x = '2'
print x+x # 4 or 22???
C++: int x = 2;
if(stringy) string x = "2";
print x+x; // 4 (string x is out of scope)