//DART
void main() {
int x;
//Postfix (e.g a++)
x =1;
print (x++); // Prints the previous value. Output is 1
print (x++); // Previous value is 1 and adds 1 to it. Output is 2
print (x++); // Previous value is 2 and adds 1 to it. Output is 3
//note: The first value will be the same. Then incements with 1 each time when it called.
//PostFix
// example
for (int i = 0; i < 5; i++){
print('The values are: ${i}');
// note that the first number will be 0
// to start from 1 change the ${i} to ${i+1}
}
}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: The difference between x++ and ++x
For further actions, you may consider blocking this person and/or reporting abuse