Ooops
October 26, 2021, 16:30:50

Author Topic: Im learning C Sharp  (Read 680 times)

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 748
  • Nothing is personal
Im learning C Sharp
« 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
Some things can break me down.
Some cant

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 823
  • Bonjour
Re: Im learning C Sharp
« Reply #1 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# .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen.

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 2789
  • I mostly code at night... Mostly.
    • SyntaxBomb - Indie Coders
Re: Im learning C Sharp
« Reply #2 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.
Mac mini ( 2018 / 2020 ), 3 GHz 6-Core Intel Core i5, 16 GB 2667 MHz DDR4, 1TB NVMe, eGPU Radeon Pro 580 8 GB, LG Ultragear 27GL83A-B 27 Inch
Mac mini (2020 ), M1 SoC, 8 GB LPDDR4, 512GB NVMe 
Commodore VIC-20, 1.1Mhz MOS 6502 CPU, 5KB RAM, VIC ( 6560 ) GPU

Until the next time.

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 748
  • Nothing is personal
Re: Im learning C Sharp
« Reply #3 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

Some things can break me down.
Some cant

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2484
Re: Im learning C Sharp
« Reply #4 on: September 20, 2021, 08:24:40 »
erm...
Code: [Select]
IF (blahblah){
     Code Blah blah
}

Code: [Select]
IF (blahblah){  Code Blah blah  }

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2484
Re: Im learning C Sharp
« Reply #5 on: September 20, 2021, 08:25:23 »
erm...
Code: [Select]
IF (blahblah){
     Code Blah blah
}

Code: [Select]
IF (blahblah){  Code Blah blah  }

not sure on this one but...
Code: [Select]
IF (blahblah)  Code Blah blah[/quote]

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 748
  • Nothing is personal
Re: Im learning C Sharp
« Reply #6 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
Some things can break me down.
Some cant

Offline Kronos

  • Jr. Member
  • **
  • Posts: 39
Re: Im learning C Sharp
« Reply #7 on: September 20, 2021, 11:57:42 »
Personally I find the for loops that use Range in Python a bit unintuitive.
Code: [Select]
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)
Code: [Select]
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)
Code: [Select]
if(x==y)
   do stuff;



« Last Edit: September 20, 2021, 12:07:46 by Kronos »

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 3237
  • elgol
Re: Im learning C Sharp
« Reply #8 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:

Code: [Select]

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:

Code: [Select]
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?   ::)
« Last Edit: September 20, 2021, 12:36:26 by Steve Elliott »
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry pi 3, pi 4, pi 400, BBC B, C64, ZX Spectrum

Offline Pfaber11

  • Hero Member
  • *****
  • Posts: 823
  • Bonjour
Re: Im learning C Sharp
« Reply #9 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 .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen.

Offline Aurel

  • Sr. Member
  • ****
  • Posts: 353
Re: Im learning C Sharp
« Reply #10 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.
(Y)

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 3237
  • elgol
Re: Im learning C Sharp
« Reply #11 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.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry pi 3, pi 4, pi 400, BBC B, C64, ZX Spectrum

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal