And I must say it makes me miss Blitzmax..
Im learning it for unity..
Its so inconvenient from Editing Aspect, but I guess I have to get used to it. I have to move on
I am having a go at learning Python as a second language . My usual is AGK studio and I have come to really like it over the last couple of years .
What it takes me hours to do in an unfamiliar language I can do in minutes in AGK and it is a joy to use . Really wish AGK would become mainstream but I don't see that happening for quite some time and it probably never will. Good luck with c# .
If you are in the process of learning C# for Unity the make sure you're using Visual Studio or Visual Studio Code with the Unity plugins. Visual Studio Community edition works better the VS Code does so I would recommend that.
You may find it best to skip doing anything with Unity initially and build up some basics in C# alone like loops, if statements, arrays, functions etc as a lot of basic game coding will involve the basics over anything super advanced. You'll find the Unity API is massive and very daunting at first with pretty wordy commands.
The fundamentals of C# are pretty easy to pick up but it's the Unity API which will suck your time up.
The thing is when i work with blitz max.. my lines are very slim..
in c sharp you want to make an If condition it goes..
IF (blahblah)
{
Code Blah blah
}
it takes one more line.. but generally it occupies more area on my screen.. so i cant see lots of code at once..
BTW Python suppose to be almost like basic.. and rather cool..
But each language is trying to out smart the other by anther method of enclosing conditions..
I think in python you dont even close an If condition
Mark Sibley Is a genius and he done exactly how a language should be!
he should get awarded a noble prize for that.
but we live in a dumb word. so i dont expect that to happen
erm...
IF (blahblah){
Code Blah blah
}
IF (blahblah){ Code Blah blah }
Quote from: iWasAdam on September 20, 2021, 08:24:40
erm...
IF (blahblah){
Code Blah blah
}
IF (blahblah){ Code Blah blah }
not sure on this one but...
IF (blahblah) Code Blah blah
[/quote]
yea i know it can be done in one line.. thats not the point..
i said when its not done in one line it become too long..
also in microsoft visual studio the gaps between each line are huge .
maybe it can be set.. ill check it..
but on default it sucks
Personally I find the for loops that use Range in Python a bit unintuitive.
For x in range(6):
print(x)
plus range is actually 0-5.
For x = 0 to 5 works pretty well for most languages and its obvious what the values are.
Unfortunately C# is a lot more verbose but you can autofill some of it. (i think typing for and then pressing tab twice in visual studio)
for(int i = 0;i<6;i++){
do stuff
}
ps
to follow up IWasAdams comment you can do this in C# where the then bit is one line(no curly brackets)
if(x==y)
do stuff;
I personally don't like the C Style for loop, it's ugly and less clear than BASIC's straightforward and clear version IMO:
BASIC:
for i = 0 to 9
with a modern twist I'd like:
for int i = 0 to 9
The problem with C-based optional block symbols { } is it can lead to bugs if code is added to a single line statement later and the user forgets to add the block statements - because only the next line will be executed.
Like in Kronos' example:
if( x == y )
do stuff;
if( x == y )
do stuff;
add do more stuff; // won't get executed as intended
As for Python, well having to ensure every line is on an exact column; what could possibly go wrong? ::)
Yes indeed the Python indentation rules can go to shit sometimes it happened to me the other day .
python sucks..it is slow
modern twist ..that just mean that variable i (should be)is local to for loop.
Yes older versions of BASIC weren't known for local specification of data types, more modern languages usually do - but I still prefer the general syntax of the BASIC for loop - all-be-it with a data type prefix.