Questions tagged [decrement]

Subtracting one from the value of a variable, generally with the use of an decrement operator.

Subtracting one from the value of a variable, generally with the use of an decrement operator(--).

425 questions
1
vote
2 answers

Cycle through elements of a relative timestamp and increment or decrement values

In Emacs, how can I create a command that will cycle through the elements of the relative timestamp entry to increment or decrement its value. For example: 01:20:12 :: Some text When anywhere on the line, a keybinding will cycle through hh, mm, ss…
user10288668
1
vote
4 answers

Ruby decrement to limit

I'd like to have a set of methods that can increment/decrement a value, but with a lower limit of zero. Basically: def decrement @value -= 1 end Except, I don't want it to go lower than zero. What's the best "ruby way" to do this?
Andrew
  • 42,517
  • 51
  • 181
  • 281
1
vote
1 answer

Dynamic DOM: How to increment/decrement IDs/Names when adding/removing dynamic elements AND when moving elements up/down the DOM?

Main Question: How can you increment/decrement IDs/Names of dynamic elements when they are added, removed, and/or moved up and down the DOM? Note: Please see the code below to understand the situation. The main focus is the script; however, I…
1
vote
2 answers

How to conditionally update counter algorithmically Java

This question is a bit confusing so I will try to explain through code and example. How can I decrement a counter if it meets a condition? Sounds simple right? But what if that method continuously gets evoked from within a for loop so that values…
arabian_albert
  • 708
  • 1
  • 11
  • 24
1
vote
2 answers

Some assembly questions regarding increment, decrement and multiplication

I'm facing some questions since they're not clearly covered in the IA-32 assembly ebook I'm studying: 1-Is the zero bit in status part of EFLAGS register the only bit among status bits affected by "INC" (increment) and "Dec" (decrement) instructions…
Pooria
  • 2,017
  • 1
  • 19
  • 37
1
vote
6 answers

How to scale loop for decrementing variables

Firstly, apologies for the poor Title. It's the best I could come up with. I've come up with a simple loop in Javascript which uses two variables and decrements each by 1 every other iteration. This is the code: for(let i = j = 999; j > 0; j > i ?…
Profplum
  • 89
  • 1
  • 9
1
vote
2 answers

Angular increment or decrement count

I'm building an Angular 5 application to track profit. My application has multiple input fields. If I sell a Chocolate then I'll press the + button to increase the count. If I sell Wine then I'll press the + button next to Wine input to increase the…
node_man
  • 1,359
  • 4
  • 23
  • 50
1
vote
0 answers

- / + random-float give a changing and a fixed number in netlogo

Hi folks I want my patch variable WTD to increase by the amount in turtle context in procedure watering-decisions . But if I write minus (-) random-float it get changed. Showed constant value otherwise. Pls, help. globals [TW well-depth] …
Sadaf
  • 163
  • 7
1
vote
1 answer

Using knex decrement with async/await

I'm getting error with while trying to use knex .decrement() withg async/await: const test = await new CollectionGroup() .where('uuid', '=', asset_collection_group_uuid) .decrement('item_out_quantity', 1); console.log('TEST',…
sg552
  • 1,521
  • 6
  • 32
  • 59
1
vote
1 answer

How to decrement the value of a label every three seconds (VB)

I am making a game for a piece of coursework and I have came across a problem. It is a very simplistic game. An enemy will spawn (Picture Box) and you will shoot it (Left Click) to make it die (Disappear). I want the user to lose 5 health for every…
1
vote
1 answer

Rollback transaction does not decrements auto incremented column?

T-SQL: BEGIN TRANSACTION Insert (col1,col2,col3) values (1,2,3) After executing above t-sql and then ROLLBACK TRANSACTION MS-SQL does not decrements auto incremented column. Any idea why? I found an answer here. Is this answer is applicable to…
shaadi
  • 161
  • 2
  • 4
  • 21
1
vote
1 answer

Can solr be used to increment/decrement?

I am working on a project right now that has a solr index of counts and ids. I am currently researching if it is possible to increment/decrement on solr directly, instead of having to retrieve the data, increment it with PHP, and then reinsert it…
Sebastian Frohm
  • 418
  • 5
  • 16
1
vote
2 answers

Trouble with ActionListener and an IF statement

I am currently having two problems both at which i have been trying to solve for the past 3 hours. I cant get the input--; to decrement if input is not == to 0 I cant get the JTextField input to update the the value i assign to it once the program…
Jakob991
  • 37
  • 1
  • 9
1
vote
2 answers

Function decreases static variable step by step, but it should not. PHP

There is a function: This code produces:…
Leonid
  • 55
  • 2
  • 10
1
vote
1 answer

Recursive Function that adds two variables passed to it

int mult2_recurse(int a, int b) { } Hello, I'm trying to fill in this function, which is passed 2 variables - called with different variables a couple times. I have to add the two variables without using any of *, /, +, =, *=, /=, +=, -= operators.…
Chris22
  • 21
  • 2