MantisBT - Documentation, Examples, and Web Site
View Issue Details
0002098Documentation, Examples, and Web SiteWriting with Informpublic2019-05-04 04:282019-05-04 04:28
mattweiner 
 
normalmildalways
newopen 
macintoshMojave?
6M62 
 
0002098: §21.2 suggests changing the value of a variable with "let"
§21.2, which is discussing how it is impossible to create a variable whose value is initially set to the empty list, says:

    On the other hand, writing

let M be { };

    is fine provided that M already exists, and then does the obvious thing - empties M.

This is only fine if M was created as a temporary variable in the same code block. If M is a global, then you’ll run into the usual issue where Inform tries to create a separate temp variable named “M” (and in this case, it will fail because it doesn’t know what kind of value is in the list).

Lab is a room.

N is a list of numbers that varies. N is {100}.

Every turn: say N.

Carry out jumping:
let N be a list of numbers;
let N be { }.
It seems like it would probably be less misleading to change the second "let" to "now"--in general I don't think there's any reason to change the values of existing variables with "let," because "now" works for temporary variables, and using "let" for globals leads to nasty and hard-to-find bugs.
No tags attached.
Issue History
2019-05-04 04:28mattweinerNew Issue

There are no notes attached to this issue.