37 AnswersNew Answer
37 AnswersNew Answer
Duplicate IT ++ means "keep adding" while -- means "keep subtracting" Therefore, if i = 1, And we want to keep adding 1, then we'll say, i++ i becomes 2 [i.e. i = 2] i ++ again i will now become 3 [i.e. i = 3] And that's how it goes on... If we want to add 3, It will be: i += 3 (or i = i + 3) So if i = 0; And we say, i += 3, then i will be 0 + 3 which is 3. i += 3 again ...will give you 3 + 3 = 6. i += 3 again ...will give you 6 + 3 = 9. i += 3 again ...will give you 9 + 3 = 12. And it keeps going that way forever...
++ is used to increase/increment the value of a variable by 1. In other words, it adds 1 to the variable. -- subtracts 1 from a variable. Loops are used for repetition.
V F Yes, it is the same in JS and many other OOP languages like Python, etc.
Please note that ++ and -- are not available in Python. Edit: oh I realise you may be using Swift.
V F This is for you. https://code.sololearn.com/Wtg4Xc2nITd6/?ref=app
Operators 1. ++ increment 2. -- decrement There are two types of increment(++) and decrement(--) operator : - (i) pre increment (ii) post increment (i) pre increment increment the values first then assign to variable. Ex: - int i =7; System.out.println(++i); // printing the variable in java O/p - 8 Here, i is incremented first by 1 and then printed so became 8 Pre Decrement System.out.println(--i); // printing the variable in java O/p - 6 Here, i is Decremented first by 1 and then printed so became 6 (ii) Post Increment is assign tge value to variable first then incremented by 1. Ex:- int i=7; System.out.println(i++); // printing statement in java O/p - 7 Here, i is printed first then assigned to variable i if we print i variable again it will print 8. Post decrement assign the value first then decremented by 1 same as post increment Ex :- int i = 8; System.out.println(i--); O/p - 8 Here, variable i printed first then incremented On printing i again System.out.println(i); o/p- 9
Hopefully, by now you understand 😊
👑Duplicate IT💫⚘🌚 (Storm Me) I can understand your problem. You are unable to understand how programming work, it means there is something wrong with your C basics. You can improve it by first clearing the basics of C and then moving to other programming languages.
++ increases the value by 1 and not by 2.
Duplicate IT 👍
Those are binary operators requiring two operands e.g. a and b. a=1 b=2 print(a+b) # gives 3 print(a-b) # gives -1
i+=3 is the same as saying i=i+3.
BTW, when using i+=3, note that the operator is += and not just +
It will be 3 more than what it was before the statement.
Just read it all slowly again
At start it will seem little bit confusing, but when you start praticing you will start to understand the concept behind it and then you can talk with your computer.
Sonic so what is single plus? + or -
Sonic where did u see the +i or i+ Like i+ = 3, i dont remember, but it like that Can you explain?
Sonic so what is the value of i, if i = i+3😂
Learn Playing. Play Learning
SoloLearn Inc.4 Embarcadero Center, Suite 1455
Send us a message