[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eDefine conversational flow logic with conditions based on data from the intent, scene, session, user, home, device, canvas, and resources objects.\u003c/p\u003e\n"],["\u003cp\u003eUtilize logical operators (\u003ccode\u003e&&\u003c/code\u003e, \u003ccode\u003e||\u003c/code\u003e, \u003ccode\u003e!\u003c/code\u003e), numerical and string operators (\u003ccode\u003e+\u003c/code\u003e, \u003ccode\u003e-\u003c/code\u003e, \u003ccode\u003e*\u003c/code\u003e, \u003ccode\u003e/\u003c/code\u003e), and comparison operators (\u003ccode\u003e==\u003c/code\u003e, \u003ccode\u003e!=\u003c/code\u003e, \u003ccode\u003e<\u003c/code\u003e, \u003ccode\u003e<=\u003c/code\u003e, \u003ccode\u003e>\u003c/code\u003e, \u003ccode\u003e>=\u003c/code\u003e) to construct conditional expressions.\u003c/p\u003e\n"],["\u003cp\u003eAccess and manipulate data within lists and maps using syntax like \u003ccode\u003ex in list\u003c/code\u003e, \u003ccode\u003elist[x]\u003c/code\u003e, \u003ccode\u003esize(list)\u003c/code\u003e, and specific notations for maps.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the comprehensive data model and usage reference for detailed information on available objects, their properties, and example syntax.\u003c/p\u003e\n"]]],["Conditional logic in scenes uses values from data model objects. Supported operators include logical (`&&`, `||`, `!`), numerical/string (`+`, `-`, `*`, `/`), and comparison (`==`, `!=`, `\u003c`, `\u003c=`, `\u003e`, `\u003e=`). Booleans (`true`, `false`) are supported. Lists use `in`, index, and `size()`, while maps allow for comparison, indexing, and `size()`. Data model objects (`intent`, `scene`, `session`, `user`, `home`, `device`, `canvas`, `resources`) can be referenced. Example syntax provided for numbers, booleans, strings, lists and maps.\n"],null,["# Conditions\n\nYou can carry out conditional logic in scenes using values from the\n[Data model](#data_model) objects. The following sections describe\nthe valid syntax for conditions.\n\nLogical operators\n-----------------\n\n| Operator | Description |\n|----------|---------------------------------------------------------------------------------------------------------------------------------------|\n| **`&&`** | Logical AND. Inner expressions are evaluated iteratively, and the evaluation is short-circuited if any expression evaluates to false. |\n| **`||`** | Logical OR. Inner expressions are evaluated iteratively, and the evaluation is short-circuited if any expression evaluates to true |\n| **`!`** | Logical NOT. The evaluation of the inner expression is negated |\n\n### Numerical and string operators\n\nThe following numerical and string operators are supported:\n\n| Operator | Description |\n|----------|-------------------------------------|\n| **`+`** | Add numbers or string concatenation |\n| **`-`** | Subtract numbers |\n| **`*`** | Multiply numbers |\n| **`/`** | Divide numbers |\n\n### Booleans\n\nThe following constant booleans are supported:\n\n| Constant | Description |\n|--------------|-----------------------------------------|\n| **`true`** | Must be lowercase |\n| **`false`** | Must be lowercase |\n| **`!false`** | Evaluates to `true`. Must be lowercase. |\n\n### Comparison operators\n\nThe following comparison operators are provided:\n\n| Operator | Description |\n|----------|---------------------|\n| **`==`** | Equals |\n| **`!=`** | Not equals |\n| **`\u003c`** | Less than |\n| **`\u003c=`** | Less than equals |\n| **`\u003e`** | Greater than |\n| **`\u003e=`** | Greater than equals |\n\n### Lists and maps\n\nGiven a list named `session.params.myList`:\n\n| Syntax | Description |\n|-----------------------------------|-------------------------------------------------------------|\n| **`x in session.params.myList`** | Returns true if the value `x` is in `session.params.myList` |\n| **`myList[x]`** | Returns the value at index `x` of `myList` |\n| **`size(session.params.myList)`** | Returns the size of a list |\n\nGiven a map named `session.params.myMap`:\n\n| Syntax | Description |\n|---------------------------------------------------|--------------------------------------|\n| **`session.params.myMap == {\"one\": 1, \"two\":2}`** | Returns `true` if maps are equal |\n| **`session['params']['myMap']['one']`** | Returns the value with specified key |\n| **`size(session.params.myMap)`** | Returns the map size |\n\nData model\n----------\n\nThe following objects can be used within scene conditions:\n\n| Syntax | Description |\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **`intent`** | [Matched intent parameter](/assistant/conversational/intents) data |\n| **`scene`** | [Slot-filling](/assistant/conversational/scenes#slot_filling) data |\n| **`session`** | [Session storage](/assistant/conversational/storage-session) data |\n| **`user`** | [User storage](/assistant/conversational/storage-user) data |\n| **`home`** | [Home storage](/assistant/conversational/storage-home) data |\n| **`device`** | Device [capability](/assistant/conversational/webhooks?tool=sdk#check_device_capabilities) and [location](/assistant/conversational/permissions) data |\n| **`canvas`** | [Canvas state](/assistant/interactivecanvas/web-apps#setcanvasstate) data |\n| **`resources`** | [Localized project resources](/assistant/conversational/build/projects?tool=sdk#add_resources) (audio, images, strings, etc.) data |\n\n| **Note:** These data values can also be referenced within [static prompts](/assistant/conversational/prompts).\n\nThe following is an example snippet of the full data model in JSON: \n\n {\n \"intent\": {\n \"params\": {\n \"\u003cparam_name\u003e\": {\n \"original\": \"five people\",\n \"resolved\": 5\n }\n }\n },\n \"session\": {\n \"params\": {\n \"\u003csession_params_key\u003e\": \"\u003csession_params_value\u003e\"\n }\n },\n \"scene\": {\n \"slots\": {\n \"status\": \"FINAL\",\n \"params\": {\n \"\u003cslot_name\u003e\": \"\u003cslot_value\u003e\"\n }\n }\n },\n \"user\": {\n \"params\": {\n \"\u003cuser_params_key\u003e\": \"\u003cuser_params_value\u003e\"\n },\n \"permissions\": [\n \"DEVICE_PRECISE_LOCATION\"\n ],\n \"accountLinkingStatus\": \"LINKED\",\n \"verificationStatus\": \"VERIFIED\",\n \"lastSeenTime\": {\n \"seconds\": 123,\n \"nanos\": 456\n },\n \"engagement\": {\n \"pushNotificationIntents\": [\n \"intent1\",\n \"intent2\"\n ]\n }\n },\n \"home\": {\n \"params\": {\n \"\u003chome_params_key\u003e\": \"\u003chome_params_value\u003e\"\n }\n },\n \"canvas\": {\n \"state\": {\n \"\u003ccanvas_state_key\u003e\": \"\u003ccanvas_state_value\u003e\"\n }\n },\n \"device\": {\n \"capabilities\": [\n \"SPEECH\",\n \"RICH_RESPONSE\",\n \"LONG_FORM_AUDIO\",\n \"INTERACTIVE_CANVAS\"\n ],\n \"currentLocation\": {\n \"coordinates\": {\n \"latitude\": 37.422,\n \"longitude\": -122.084\n },\n \"postalAddress\": {\n \"revision\": 0,\n \"regionCode\": \"US\",\n \"languageCode\": \"en\",\n \"postalCode\": \"94043\",\n \"sortingCode\": \"\",\n \"administrativeArea\": \"California\",\n \"locality\": \"Mountain View\",\n \"sublocality\": \"\",\n \"addressLines\": [\"1600 Amphitheatre Parkway\"],\n \"recipients\": [],\n \"organization\": \"\"\n }\n }\n },\n \"resources\": {\n \"strings\": {\n \"\u003cresource_string_key\u003e\": \"\u003cresource_string_value\u003e\"\n },\n \"images\": {\n \"\u003cresource_image_key\u003e\": \"\u003cresource_image_value\u003e\"\n }\n }\n }\n\nUsage reference\n---------------\n\nThe following syntax examples assumes you are working\nwith `session.params` object: \n\n session.params = {\n \"flag\": true,\n \"count\": 10,\n \"name\": \"john smith\",\n \"myList\": [1, 2, 3],\n \"myMap\": {\"one\": 1, \"two\":2}\n }\n\nYou can carry out the following conditional operations: \n\n // numbers and boolean logic\n session.params.count \u003e 0 && session.params.count \u003c 100 // AND\n session.params.count == 0 || session.params.count != 5 // OR\n !(session.params.count \u003c= 0) // NOT\n\n // booleans\n !false // true constant\n session.params.flag // boolean variable\n session.params.flag == true // explicitly compare with true constant\n\n // strings\n session.params.name == \"john smith\" // double quotes supported\n session.params.name == 'john smith' // single quotes supported\n session.params.name.contains(\"john\") // substring\n session.params.name + \"!!!\" == \"john smith!!!\" // string concatenation\n session.params.name \u003c \"abc\" // compares lexicographically\n size(session.params.name) == 10 // length of string\n\n // lists\n 1 in session.params.myList // \"contains in list\" operator\n session.params.myList[0] == 1 // \"index into list\" operator\n size(session.params.myList) == 3 // returns number of elements in the list\n\n // maps\n session.params.myMap == {\"one\": 1, \"two\":2} // compare map with json\n session['params']['myMap']['one'] == 1 // index using square brackets\n size(session.params.myMap) == 2 // number of entries in the map"]]