How should i write the code?
Were to put spaces betwwen lines?
How much of a indent on the side?
Thanks
that's by far not as much formatting as i am doing comming from java/eclipseYeah, you should decide yourself what you want your code to look like. Chances are, you are the only person who will look at your code, so as long as you can read it again in the future, it's ok.
Personally, I type my code as neat as possible. See HERE for example. That's because I'm a perfectionist, and because I know that if I look back at my programs in a couple of months time, I'm not going to want to spend ages working out what I meant at line 34!
In summary, as long as you put spaces in the places where you NEED spaces, then you can spread the code out as much as you like!
as someone who's first language is also lua how hard was the transition to C++ ? I am concidering trying it my self any tips ?Lua was my first programming language, so any code I write now (C++) follows the rules that I made up when using Lua (where possible!).
function someFunction()
doSomethingHere()
if some_condition then
doSomethingElse()
end
end
while true do
local evt, id, msg = os.pullEvent()
if evt == "rednet_mesage" then
if id == someID then
print("Message: ", msg)
end
else
print("Not a rednet message :)/>/>")
end
end
I can't really say that, since I started with C/C++, then Java and now Lua (with some other languages in the middle), but I can say that they are completly different things. To start, Lua is an interpreted language, while C/C++ is compiled, so you'll have to learn something about compiling and that (if you use an ide, it does all the work for you, but it's good to know anyway). Also, C++ is object oriented, wich adds objects, classes, etc. And so much more, but this is kinda off-topic, so I better stop :ph34r:/>/>.as someone who's first language is also lua how hard was the transition to C++ ? I am concidering trying it my self any tips ?Lua was my first programming language, so any code I write now (C++) follows the rules that I made up when using Lua (where possible!).
as someone who's first language is also lua how hard was the transition to C++ ? I am concidering trying it my self any tips ?
Well, I never found tutorials that good, it's really well explained.
I learned C at the university, in the programming class, and then started learning C++ with tutorials and just trying by myself. If you like programming, it's easy to learn any language, and when you already know one, it's even easier, since they are all basically the same, just with a different syntax.
When I get bored of life I'll move to this: http://en.wikipedia.org/wiki/LOLCODE
wait what did i just, no this cant be, oh really i guess, WTFWhen I get bored of life I'll move to this: http://en.wikipedia.org/wiki/LOLCODE