Problem with compilnig - float array problem ?

Hi,

Welcome all - this is my first post :slight_smile:

I have a problem with compiling a program on attachment.

The error is:

"Invalid operands of types "float" and "float[12]" to binary 'operator>='

Can someone help me with this problem?

It's important soft for me.

Sorry for my english :slight_smile:

itatun.pde (1.76 KB)

Β  Β  if (val>=tchords && val<schords)

tchords and schords are arrays. You can't compare an element to an array.

Thank Yoy PaulS

Oh i see ..

What is solution for this?

Can You write me some parts of code?

What is solution for this?

First, you explain why you think you can compare val to an array, and then you explain why you need to do that the same number of times as there are elements in the array.

What it looks like you are trying to do is compare val to the ith element of the array(s). But, you left out the [ i ].

Yes PaulS, this is it: i left out the
Thank You for helping!

An understanding of the difference between where a variable lives in memory and what's stored there would help you, which means understanding lvalues and rvalues. For example:

might help.

Fred has a bag. The bag is full of oranges.

Jane has an orange.

Is Jane's orange >= Fred's bag of oranges?

Wait - what? What are we asking? Do we want to know if Jane's orange is >= every orange in Fred's bag? >= just the first orange? >= any orange? >= at least half the oranges? >= the average size of the oranges? What?

An array holds a number of float values. It's not meaningful to ask of a single float vale is >= the array.