0
Why doesn't code works simply? Like just typing "make circle of this much diameter"
I'm new to coding and I have lots of questions.... why do u need a specific format? why not create a code writing area where things are simple?
4 Réponses
+ 5
Natural (human) language is actually very complex and ambiguous (even humans misunderstand each other sometimes!). The constraint format of a coding language removes this ambiguity and makes it easier to convert into machine instruction..
+ 5
With the recent progress of computing and artificial intelligence computers are now beginning to do more complex things like computer vision and recognising natural language. but underlying this, formal coding language is still needed to translate into what the machine can understand.
+ 4
You can, and it kinda is.
If you look at things like processing its fairly straight forward.
circle(xc,yc,diam);
draws a circle at position xc yc with size diam.
Things aren't in pure english like that because its not practical. But it really is that way when read in English.
In a game lets say I have players HP. So I create a variable for the players HP to keep track of his HP.
The player gets hit, so he should lose hp.
Instead of saying "decrease player hp by hitDmg" I write playerHP -= hitDmg; Which is the same thing when read out in English.
+ 2
Actually it is simple. Just think about learning a language where you can explain everything with just 50 words....
Also it is needed to define how everything must be described. Otherwise everybody would use his own slang words, and these msy not known by others