references/sleep-functions/clear.md

GitHub

clear

Category: Arrays

Source: https://sleep.dashnine.org/manual/clear.html


Synopsis

clear(@array)

Removes all of the contents from @array.

clear(%hash)

Removes all of the contents from %hash.

Parameters

@array, %hash - the array to remove the contents from

Side Effects / Notes

  • This function clears the contents of the passed in data structure.

Examples

Example:

@a = @(1, 2, 3, 4, 5);

clear(@a);

println("@a is: " . @a);

Output:

@a is: @()

See Also

&add; &addAll; &remove; &removeAt; &removeAll; &splice