I've been learning dart for a couple of weeks and here where I was trying to print a stack of starts (*) I discovered that there is no print method to print horizontally. It always creates a new line after it executes the print method. Here is my code:
main(List<String> args){
for(int i = 0; i<3; i++){
for(int k =0; k<=i; k++){
print("*");
}
}
}
Here is the output:
You should write directly to the stdout
stream:
import 'dart:io';
main() {
stdout.write('*');
stdout.write('*');
}
As an aside, if you want to print the same character multiple times you can multiply strings in Dart!
print('*' * 10);
will output
**********
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With