SyntaxBomb - Indie Coders

Languages & Coding => BlitzMax / BlitzMax NG => Topic started by: Hardcoal on September 19, 2021, 14:19:38

Title: Im learning C Sharp
Post by: Hardcoal on September 19, 2021, 14:19:38
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
Title: Re: Im learning C Sharp
Post by: Pfaber11 on September 19, 2021, 23:04:35
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# .
Title: Re: Im learning C Sharp
Post by: Qube on September 20, 2021, 04:15:40
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.
Title: Re: Im learning C Sharp
Post by: Hardcoal on September 20, 2021, 05:38:45
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

Title: Re: Im learning C Sharp
Post by: iWasAdam on September 20, 2021, 08:24:40
erm...

IF (blahblah){
     Code Blah blah
}



IF (blahblah){  Code Blah blah  }
Title: Re: Im learning C Sharp
Post by: iWasAdam on September 20, 2021, 08:25:23
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]
Title: Re: Im learning C Sharp
Post by: Hardcoal on September 20, 2021, 08:50:32
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
Title: Re: Im learning C Sharp
Post by: Kronos on September 20, 2021, 11:57:42
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;




Title: Re: Im learning C Sharp
Post by: Steve Elliott on September 20, 2021, 12:32:44
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?   ::)
Title: Re: Im learning C Sharp
Post by: Pfaber11 on September 20, 2021, 12:44:56
Yes indeed the Python indentation rules  can go to shit sometimes it happened to me the other day .
Title: Re: Im learning C Sharp
Post by: Aurel [banned] on September 20, 2021, 19:08:59
python sucks..it is slow

modern twist ..that just mean that variable i (should be)is local to for loop.
Title: Re: Im learning C Sharp
Post by: Steve Elliott on September 20, 2021, 19:59:53
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.