Questions tagged [operands]

Operands are values acted upon by an operator, method, or other functional entity.

Operands differ from parameters in that they are the real values used or altered by a function, while the parameters are the named, abstract inputs used to define the function.

313 questions
50
votes
3 answers

Bad operand type for unary +: 'str'

I cannot figure out a problem I am having with code written in Python 2.7. I am converting the references to ints, but I keep getting a type exception bad operand type for unary +: 'str'. Can anyone assist? import urllib2 import time import…
heinztomato
  • 795
  • 1
  • 7
  • 12
45
votes
5 answers

PHP &$string - What does this mean?

I've been googling but I can't find anything. $x->func(&$string, $str1=false, $str2=false); what does that & before $string &$string do?
Mickey
  • 2,285
  • 6
  • 26
  • 37
39
votes
4 answers

TypeError: unsupported operand type(s) for -: 'list' and 'list'

I am trying to implement the Naive Gauss and getting the unsupported operand type error on execution. Output: execfile(filename, namespace) File "/media/zax/MYLINUXLIVE/A0N-.py", line 26, in print…
Iliass
  • 527
  • 2
  • 6
  • 13
23
votes
2 answers

What is this operand (*= star-equals) in SQL server 2000?

I have a query that I pulled from ms sql 2000 and plugged into a MySql query. It did not work, MySql would choke on the *= operator. In this example I have two varchar columns called person_name. SELECT * FROM tbl1 a, tbl2 b WHERE a.id = b.id AND…
Blaise Swanwick
  • 1,735
  • 1
  • 16
  • 18
19
votes
10 answers

Decimal and mathematical operations

I have a simple conversion of a decimal in C#. It looks like this: private decimal BaseValue { get; set; } public decimal ConvertedValue { get { return BaseValue * (365 / 360); } } However, this does not work. I assume…
Jakob Busk Sørensen
  • 5,599
  • 7
  • 44
  • 96
18
votes
2 answers

Binary operator + cannot be applied to two int operands

Hi I have a question about this code: 1) let label = "The width is " let width = 94 let widthLabel = label + String(width) 2) let height = "3" let number = 4 let hieghtNumber = number + Int(height) The first part is working just fine, but I don't…
Neli Chakarova
  • 660
  • 1
  • 5
  • 18
16
votes
4 answers

Why do 'and' & 'or' return operands in Python?

I'm going through the LPTHW and I came across something I cannot understand. When will it ever be the case that you want your boolean and or or to return something other than the boolean? The LPTHW text states that all languages like python have…
15
votes
2 answers

map operator [] operands

Hi all I have the following in a member function int tt = 6; vector>& temp = m_egressCandidatesByDestAndOtMode[tt]; set& egressCandidateStops = temp.at(dest); and the following declaration of a member variable map
Jamie Cook
  • 4,375
  • 3
  • 42
  • 53
13
votes
2 answers

Converting signed to unsigned in Swift

In C, I am able to do a trick with numbers: uint8_t value = 0 int delta = -1 uint8_t result = value + delta /* result will be 0xFF */ Is there a way of doing the same in Swift? Notice that the same approach doesn't work: let value: UInt8 = 0 let…
George
  • 1,235
  • 10
  • 23
10
votes
2 answers

Unsupported operand type(s) for +: 'WindowsPath' and 'str'

The code I'm working on throws the error Unsupported operand type(s) for +: 'WindowsPath' and 'str'. I have tried many things, and none have fixed this (aside from removing the line with the error, but that's not helpful). For context, this script…
Moonaliss
  • 103
  • 1
  • 1
  • 6
10
votes
2 answers

What are the academic names for the left and right operands in binary relational operator?

Relational operators such as <, >=, == are often not bidirectional. What are the correct names for the operands to these operators? An example from an non-relational operator, division, would be the operand names divisor and dividend.
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
10
votes
2 answers

Why is Netbeans suggesting I "Flip operands of the binary operators" in my Java code

Netbeans frequently suggests that I "flip operands of the binary operator" when I'm doing mathematical calculations. For example, in the following line of code: change = 100 - price; quarters = change / 25; dimes = change % 25 / 10; …
Lauren Stephen
  • 101
  • 1
  • 1
  • 9
10
votes
2 answers

Javascript: Comparing SINGLE Value Against MULTIPLE Values with OR Operands

Possible Duplicate: Check variable equality against a list of values Javascript if statement with multiple permissible conditions I must click the same 21 of 253 items (li) in a dropdown list (ul). Scrolling I'll have to do this for the same list…
AlecPerkey
  • 659
  • 2
  • 11
  • 21
9
votes
1 answer

Operand size prefix in 16-bit mode

I'm trying to understand GAS's behavior of .code16. From the manual, it seems in 16-bit section, for 32-bit operands or instructions, a 66H operand override prefix will be produced for the instruction encoding. Does that mean .code16 movw %eax,…
Oxdeadbeef
  • 1,033
  • 2
  • 11
  • 26
8
votes
3 answers

CS0019 Operator cannot be applied to operands of type 'bool' and 'int'

This program is in response to the assignment: "Create a method named Sum() that accepts any number of integer parameters and displays their sum. Write a Main() method that demonstrates that the Sum() method works correctly when passed one, three,…
Nooob
  • 307
  • 3
  • 6
  • 10
1
2 3
20 21