How do I set a variable to the value of a field another field? How do I set a variable to the value of a field another field?

For example, what is the equivalent of the following code, which should set the value of video_Source to the value of the field that is not empty/null?

{% set video_Source = content.field_video_upload or content.field_video_youtube %}
This is something better suited for preprocess in my opinion (I don't like a lot of conditional etc logic in twig files):

$variables['node_video'] = NULL;

if ($node ... field_a has value) {
  $variables['node_video'] = // set to render element for field a in 'content';
}

if ($node ... field_b has value) {
  $variables['node_video'] = // set to render element for field b in 'content';
}


Then in twig:

{% if node_video %}
  {{ node_video }}
{% endif %}


Basically, if this variable is not null, it should point to one of the $variables['content']['field...'] items from the preprocess code, then render it. {{ node_video }} in this case is the equivalent of {{ content.field_name }}, to spare a lot of IF/ELSE/OR stuff in Twig.

But what is likely easier is leveraging Media and Media Youtube with Media Video and using one field. That should scale. Imagine you want to add Vimeo, Twitch, or other supported Media sources in the future, you would have to keep expanding on this code.