Completing C code with D style
forkit
forkit at gmail.com
Sun Nov 14 04:29:53 UTC 2021
On Saturday, 13 November 2021 at 23:02:15 UTC, pascal111 wrote:
>
> I touch that D is big language, it's not small like standard C.
> This will cost me much studying, so I think I need slow down
> and learn it step by step.
Yes. C is so much smaller, and thus simpler (till you wanna do
something complex)
But C also makes it 'simpler' to shoot yourself in the foot ;-)
Even with your simple C code, which is so easily tranposed to D,
you already benefit from:
- variables being always initialised before use
(i.e no need to initalise i in your for loop, in D)
- array indices being automatically checked for out-of-bounds
(i.e. i < 10 ... in D.. it becomes.. numbers.length )
so you can make your simple code, even 'simpler' in D ;-)
More information about the Digitalmars-d-learn
mailing list