Comparing multiple strings in If

A bit of a noob question here. I'm wanting to check what viewport the user is in using an if statement.

So:

currentView = (viewport.getType() as string)
if currentView == "view_top" then
(
THINGS!
)

Which is fine, so I wanted to check if the condition is true for multiple views using:

if currentView == "view_front" or "view_left" then
(
THINGS!
)

But it does not work. I've been trying to search how but using "or" within Google search strings isn't that helpful.

Any help would be awesome!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mackinder's picture

Oh I see! Thank you ever so

Oh I see! Thank you ever so much!

Garp's picture

Boolean operations.

Boolean operators test between conditions (boolean values). Your code is testing between a condition and a string.
if currentView == #view_front OR currentView == #view_left then ...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.