1. You have to enclose the function body with curly brackets.
int GV2() {return 512; }
2. When you declare a variable inside an if statement like that the variable is only in scope inside that if statement. If you want to be able to use the variable after the if statement you should declare, and intitilize it to some default value, before the if statement and then use assignment inside the if statement instead.
1 2 3 4
int t1 = 10;
int t2 = 0;
if(t1 == 10) t2 = GV();
// Use t2 here...
Sorry about my horrible English and more weird Questions.
But is any possible just make the
if statement or function become Python-Like ?
Because I really like the way how Python implement a funciton.
More clear ( But sometimes that will cause some FUZZY information)
But I like it !
So..Is any "Coding Style" or "Plug-in" can do the thing what I describing ?
e.g
--- C++
int funcA(){
...
return foo;
}
--- Py
funcA()
\t ...
\t return foo
*That's not necessary.But I still wanna ask more. Thanks !
Uh...
Just because Python is really slow for huge computation.
And I think C++ still the main Program Lauguage in the world
Just thinking
If C++ can make the function prototype or any~
Just use the TAB to make it "readable"
(I am not talking C++ is not readable)
But compare with C++. Python is more clear.
I am not being rude...
Just try to figure out it's any method to make C++ coding like Python.
Initially new languages will be "less clear" compared to languages you know. I'm trying to learn some javascript at the moment and i hate it because it's not intuitive to me at all. But i realise it's because i'm not used to it. yet.
This is only my opinion by the way :)