To take multiple single line input in dart | dart programming | dart tutorial
Hello friend, are you facing problem while taking integer input in dart. hey don't worry i am here. While solving many competitive problem in dart you might face this issue where you want a single command line input from the user and using those input as an integer.
The basic approach for this problem while be taking an input as a string later splitting it and forming the list. After that with the help of indexing we can extract the element of the list.
Here is the code
So here
- we take String k as input.
- Then we form list of it as lst.
- Since this is string we parse it to convert it into integer.
- finally you can use it any where now.
Thank you this was just as simple explanation. I hope you get the answer.
Comments
Post a Comment