How to bring something forward

I thought it was like something with the syntax but it’s just because the text is behind the rectangles, can someone help me?:

displayMode(FULLSCREEN)
supportedOrientations(LANDSCAPE_ANY)

-- Use this function to perform your initial setup
function setup()
    text1=true
    fan1=0
    fan2=0
    fan3=0
    fan4=0
    fan5=0
    fan6=0
    fan7=0
    fan8=0
    fan9=0
    fan10=0
end
-- This function gets called once every frame
function draw()
    -- This sets a dark background color
    background(255, 255, 255, 255)
    strokeWidth(10)
    stroke(0, 0, 0, 255)
    fill(0, 252, 255, 255)
    --big square baby blue
    rect(160,100,150,150)
    rect(295,100,150,150)
    rect(430,100,150,150)
    rect(565,100,150,150)
    rect(700,100,150,150)
    --next
    rect(160,240,150,150)
    rect(295,240,150,150)
    rect(430,240,150,150)
    rect(565,240,150,150)
    rect(700,240,150,150)
    --next
    rect(160,380,150,150)
    rect(295,380,150,150)
    rect(430,380,150,150)
    rect(565,380,150,150)
    rect(700,380,150,150)
    --next
    rect(160,520,150,150)
    rect(295,520,150,150)
    rect(430,520,150,150)
    rect(565,520,150,150)
    rect(700,520,150,150)
    --wall lime green
    fill(4, 255, 0, 255)
    rect(-100,520,150,150)
    rect(-100,380,150,150)
    rect(-100,240,150,150)
    rect(-100,100,150,150)
    --wall2 purple
    fill(191, 0, 255, 255)
    rect(975,520,150,150)
    rect(975,380,150,150)
    rect(975.0,240,150,150)
    rect(975,100,150,150)
    --bottom blue
    fill(0, 60, 255, 255)
    rect(160,-100,150,150)
    rect(295,-100,150,150)
    rect(430,-100,150,150)
    rect(565,-100,150,150)
    rect(700,-100,150,150)
    --top red
    fill(255, 0, 0, 255)
    rect(160,725,150,150)
    rect(295,725,150,150)
    rect(430,725.0,150,150)
    rect(565,725,150,150)
    rect(700,725,150,150)
    end
if text1 == true then
    font("Futura-CondensedExtraBold")
    fontSize(40)
    fill(0, 0, 0, 255)
    strokeWidth(5)
    stroke(255, 255, 255, 255)
    text("Tap on each Fan to turn them on and off",WIDTH/2,HEIGHT/2)
end

Your problem is the “end” after the last rect command. Move it to the bottom of the code, after the other “end”.

You really should use loops and tables for this. For example, setting the fans to 0 with a table becomes

fans={0,0,0,0,0,0,0,0,0,0}

It is going to be a nightmare of repeated code, the way you’re doing it.

and since you are drawing regularly spaced rectangles, that could be done in a couple of loops, very compactly.

Thanks, and I know how to use loops, at least in Java script, I’d need more practice but I will try what you said to do

Having looked at your program colours, can I suggest you make the lines thinner (or less black, eg medium gray) and colours less bright (closer to pastel)? The screen is quite hard to look at and I think would give me a headache.

I’m not trying to be critical in saying this, just trying to help.

If you need info on tables, they are very different from Javascript, and they are extremely important in Codea.

I cover them in my Lua ebook here

https://www.dropbox.com/s/qh1e7ft4rvhlpt2/Lua%20for%20beginners.pdf

I will take a look at the tables help, and I’m just using this as a model for something I’m making, but thanks for your help