Dojo Build - difference between profile formats

I’m trying to learn how to use the dojo build system, but there is some confusion about the build profiles. Some examples in the buildprofiles folder of the source code have profiles that look like this

dependencies = {
	layers: [
		{
			// This is a specially named layer, literally 'dojo.js'
			// adding dependencies to this layer will include the modules
			// in addition to the standard dojo.js base APIs.
			name: "dojo.js",
			dependencies: [
				"dijit._Widget",
				"dijit._Templated",
				"dojo.fx",
				"dojo.NodeList-fx"
			]
		}
	],

	prefixes: [
		[ "dijit", "../dijit" ],
		[ "dojox", "../dojox" ]
	]
}

But others have them written to a variable like this

var profile = (function(){
	return {
		// relative to this file
		basePath:"../../../../..",

		// relative to base path
		releaseDir:"dojo/tests/_base/loader",

		optimize:0,
		layerOptimize:0,
		insertAbsMids:0,
		releaseName:"coolioBuilt",
		selectorEngine:"lite",
		//scopeMap:[["dojo", "cdojo"], ["dijit", "cdijit"], , ["dojox", "dojox"]],

		// and include dom-ready support
		staticHasFeatures:{
			"dojo-publish-privates":1
		},


		packages:[{
			name:"dojo",
			location:"./dojo",
			trees:[
				[".", ".", /(\/\.)|(^\.)|(~$)|(tests\/_base\/)/]
			]
		},{
			name:"dijit",
			location:"./dijit"
		},{
			name:"dojox",
			location:"./dojox"
		},{
			name:"coolio",
			location:"./dojo/tests/_base/loader/coolio",
			resourceTags:{
				amd: function(filename, mid){
					return /calendar-amd\.js$/.test(filename);
				}
			}
		}],

		layers:{
			"dojo/dojo":{
				customBase:1
			},
			"dojo/main":{
				include:["dojo/parser"]
			},
			"dijit/Calendar":{
				include: [
					"dijit/Calendar"
				]
			}
		}
	};
})();

The examples on the Creating Builds documentation also have this style
https://dojotoolkit.org/documentation/tutorials/1.10/build/

What is the difference?

They’re basically the same, in that they both return an object. But the second one is an IIFE (immediately invoked function expression) that returns an object. The second is more flexible for when you want to have some JS logic that is evaluated at the time the build profile is run.