3 Rectangles - 3 Colors

fill(173, 117, 33); //draws bookshelf
rect(0, 120, width, 10);

var library = [ //array of 3 objects

{ title:”I Know Why The Caged Bird Sings”,
author:”R. Michener”,
stars:4,
color:(100 + i50, 100 + i50, 100 + i*50)},

{ title:”Alaric the Goth”,
author:Boin,
stars:4,
color:(100 + i50, 100 + i50, 100 + i*50)},

{ title:”Caesar Invades Gaul”,
author:”Goldsworthy”,
stars:4,
color:(100 + i50, 100 + i50, 100 + i50)}
];
//draws the rectangle for each book with different colors
for(var i = 0; i < library.length; i++) {
fill(100 + 50
i,100 + 50i,100 + 50i);
rect(10 + 120*i,20,90,100);
}

ultimately the idea is to take ALL the info in the 3 objects and visualize them like so -

but this is quite a complex undertaking(for me anyway) and with the above code, all I wanted to do was simply see whether I could get a for loop to
- place the rectangular outline on the bookshelf
- get a different color for each of the rectangles
I will worry about the title / author display as well as the stars later. I have a feeling that I should be calling the color property in my for loop to implement the different colors that I want but I can’t see how to do this

Looks like you’re still struggling with syntax errors. First theres a string without quotes:

author:Boin,

should be

author: "Boin",

then it looks like all your other problems are a bunch of cases of i50 or 50i that should be i*50 or 50*i.

Unreal ! That after all this practise, I am still making these errors. Thanks for pointing them out. I will struggle on.

You’ll get there :wink: