Skip to content

Variable scope differs between Javascript and webppl #103

@stuhlmueller

Description

@stuhlmueller

Consider this example:

if (true){
  var x = 1;
} else {
  var x = 2;
}
x

In Javascript, if blocks don't introduce new scope, so x is 1. In webppl, this results in

Uncaught ReferenceError: x is not defined

This isn't necessarily a problem (in this example, can use ternary operator), but we should document differences like this at some point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions