Dart programming for all
I am using the online compiler, Dartpad.
I am starting off with writing my own name
Where I make a lot of mistakes
I will keep this syntax intact and try to print more strings.
Can I print a number?
Yes, I can. And, notice how the variable, name, changed from a string to an integer type.
The output is 56.
Can I add two numbers?
Yes, the output is 118 again.
I made a mistake that I did not write 'var' before name3. I later corrected it for it had returned an error.
We can define the variable type of name as a string and that of name1 as an integer. Then I will not make any mistakes in assigning values. Even if I did make a mistake, dart would show me an error message.
It turned out that Dart is case sensitive. string was returning an error. I had to write String. Int did not work but int did. Yes, I got the correct outputs for both these inputs.
Let us assign 23 to name.
Bookmark this honest notebook of a student for it will keep increasing in the future.
Comments
Post a Comment