ScriptSpot

Forum topic · General Scripting

Comparing multiple strings in If

By Mackinder · 2011-03-02

Description

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 (2)

Mackinder · 2011-03-04

Oh I see! Thank you ever so much!

Boolean operations.

Garp · 2011-03-02

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 ...