A With block names an object once, then lets you reach its members with the short its\ prefix – so you don't repeat the variable on every line. It works for both Types and Elements.
With p
its\name = "Dabz" ' same as p\name = "Dabz"
its\hp = 100
its\x = 50
its\y = 120
EndWith
its is the possessive pronoun – its\name reads as "its name", which is exactly what it is: a member of the block's subject.
its\ resolves anything the subject has – both fields and methods:
With enemy
its\hp = its\hp - 10 ' read and write fields
its\Describe() ' call a method
EndWith
You can use its\ inside a string interpolation hole, just like any other expression:
With p
Print "Spawned {$its\name} with {%its\hp} HP"
EndWith
With blocks nest. Inside a nested block, its\ always refers to the innermost subject:
With a
its\x = 1 ' a
With b
its\x = 2 ' b (innermost)
EndWith
its\y = 9 ' a again
EndWith
Inside a Method the two never clash: this\ is the object the method belongs to, and its\ is the current With subject.
Method Attack(target:TEnemy)
With target
its\hp = its\hp - this\damage ' its = target, this = the attacker
EndWith
EndMethod
See With.bam for Types, Elements, method calls, interpolation and nesting all in one.
BambooBasic © 2026 Michael Denathorn