Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Expression Error: If Else not working???

Explorer ,
May 21, 2020 May 21, 2020

V = effect("Slider Control")("Slider");

if (V > 0) X = 100 else X = 0;

[X,X]

 

This is just about as simple as it gets but I get this error:

 

Error: Syntax error: Unexpected token else (And this is about line 2 obviously)

 

What? I could swear this is similar to what I've done before. Help me out!

TOPICS
Error or problem , Expressions , How to
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 21, 2020 May 21, 2020

Never mind, I got it. Curly brackets... {100} {0} or legacy ExtendScript in project settings.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 21, 2020 May 21, 2020
LATEST

Or:  

X = (V > 0) ? 100 : 0;

 

Dan

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines