Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Iterate over each object in the list using a for loop
- var i;
- for (i = 0; i < ds_list_size(objList); i++)
- {
- // Get the object at the current index in the list
- var obj = ds_list_find_value(objList, i);
- // Code to be executed for each object in the list
- // Perform an action on the current object
- obj.action();
- }
- FOR ARRAY
- // Create an array and add some objects to it
- var objArray;
- objArray[0] = obj_Object1;
- objArray[1] = obj_Object2;
- objArray[2] = obj_Object3;
- objArray[3] = obj_Object4;
- // Get the length of the array
- var arrayLength = array_length_1d(objArray);
- // Iterate over each object in the array using a for loop
- var i;
- for (i = 0; i < arrayLength; i++)
- {
- // Get the object at the current index in the array
- var obj = objArray[i];
- // Code to be executed for each object in the array
- // Perform an action on the current object
- obj.action();
- }
- NULL VERIFICATION
- if (obj != null)
- {
- // Code to be executed for non-null objects
- // Perform an action on the current object
- obj.action();
- }
- else
- {
- break
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement