+1 vote

I tried this code:

shader_type canvas_item;

void fragment() {
    for (int i, i < 10, i++) {
        float asdf = 1.0;

I get this error:

error(4): Expected expression, found: CF_FOR

Is there something wrong with my syntax or are for loops not implemented yet?

in Engine by (58 points)

1 Answer

+1 vote

Try to write for (int i = 0; i < 10; i++) ? (with semicolons)
If it doesn't work you could report an issue on Github, because for loops are supported in the underlying GLSL.

by (29,120 points)

Tried with semicolons as well and I get them same error. I guess I'll create an issue for it.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.