-
-
Save cole007/b0a0fee593bdaf16fd14b3b134effb7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro revealSecret(startId, elements) %} | |
{% set outputInt = startId %} | |
{% set outputStr = startId %} | |
{% set end = false %} | |
{% for i in 0..elements|length if end == false %} | |
{% set el = elements[outputInt] %} | |
{% if '+' in el.nextElement %} | |
{% set arr = el.nextElement|split('+') %} | |
{% set output = arr[0] + arr[1] %} | |
{% elseif '*' in el.nextElement %} | |
{% set arr = el.nextElement|split('*') %} | |
{% set output = arr[0] * arr[1] %} | |
{% elseif '/' in el.nextElement %} | |
{% set arr = el.nextElement|split('/') %} | |
{% set output = arr[0] / arr[1] %} | |
{% elseif '-' in el.nextElement %} | |
{% set arr = el.nextElement|split('-') %} | |
{% set output = arr[0] - arr[1] %} | |
{% else %} | |
{% set output = el.nextElement %} | |
{% endif %} | |
{% if el.nextElement is null %} | |
{% set end = true %} | |
{% set outputStr = outputStr ~ ' > ' ~ el.title %} | |
{% else %} | |
{% set outputInt = output %} | |
{% set outputStr = outputStr ~ ' > ' ~ output %} | |
{% endif %} | |
{% endfor %} | |
{{ outputStr }} | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment